kareem_elzeiny Posted August 11, 2010 Share Posted August 11, 2010 HI, I have a blogspot blog and I want to Open the links that doesn't belong to my blog pages in new window in new windowI've Tried this code : <base target='_blank'> but it open all links in new pageSo please tell if any body have a code or script can help me in thisRegards, Link to comment Share on other sites More sharing options...
Ingolme Posted August 11, 2010 Share Posted August 11, 2010 The target attribute is deprecated in HTML 4.01 but a Transitional DTD will allow you to use it.Just put the target attribute on the links that you want opened in a new window. Link to comment Share on other sites More sharing options...
kareem_elzeiny Posted August 11, 2010 Author Share Posted August 11, 2010 I know that I can add Target="_blank" at the end of each link ,But I can't add it manually because there are too many linksthanks for your reply Link to comment Share on other sites More sharing options...
Ingolme Posted August 12, 2010 Share Posted August 12, 2010 Hmm, you would need a Javascript solution. The disadvantage is that users could have Javascript disabled.The procedure is the following: Get all the links using document.getElementsByTagName(). Look through the href property of each one to see if the domain matches your site's domain. You can use Javascript String methods for this. Add the target attribute to the element if the previous condition is true. Link to comment Share on other sites More sharing options...
Howdy_McGee Posted August 12, 2010 Share Posted August 12, 2010 I would be careful with a new window though. Some browsers or ad ons could classify it as a "Pop Up" so your probably better off having it pop up in a new tab anyway IMO. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.