BCD 1 Report post Posted June 7, 2009 (edited) Consider there are several links in an inline frame. How to make those links open in a new window instead of opening in the same frame. I have tried parent, blank targeting but they don't seem to work. Is there any other method? I don't want to change anything inside the iframe.Thanks. Edited June 7, 2009 by BCD (see edit history) Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted June 7, 2009 target=_blank Share this post Link to post Share on other sites
BCD 1 Report post Posted June 7, 2009 (edited) target=_blank doesn't work. I have even tried "_parent" and "_top". I will put the code here to know what I mean.index.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Semi Transparent Player</title></head><body><div><iframe name="FRAME1" target="_blank" src="contact.html" width="730" height="260" frameborder="1" ></iframe><p>INDEX PAGE</p></div></body></html> contact.html:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>ST Player: Contact</title></head><body><div><p><a href="index.html">A Link inside iframe. Make me open in a new window.</a></p></div></body></html> I want to make the link inside the iframe to open in a new window. I don't want to manually add target=_blank to each of the links. So I want to know if there is some code which can automatically make all the links to open in new window. May be some javascript code does that?Thanks for the help. Edited June 7, 2009 by BCD (see edit history) Share this post Link to post Share on other sites
kleong 0 Report post Posted June 7, 2009 The target="_blank" should be in the contact.html and not the index.html. This should solve the problem. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>ST Player: Contact</title></head><body><div><p><a href="index.html" target="_blank">A Link inside iframe. Make me open in a new window.</a></p></div></body></html> Share this post Link to post Share on other sites
BCD 1 Report post Posted June 7, 2009 Yes kleong that would solve the problem, but in my case there are tons of links inside the iframe and so I cannot manually specify target to each of them. So I was asking if there attribute which we can specify on the iframe itself so that all the links open in new window. I think I should find another solution to my problem now. Thanks for your replies. Share this post Link to post Share on other sites
galexcd 0 Report post Posted June 7, 2009 (edited) Find & Replace ftwFind: <a href=Replace: <a target="_blank" href=Most basic text editors should be able to do this.And if you still don't want to do that I suppose you could let php do the hard work for you. You will need to rename contact to contact.php or add html as one of the file types that php parses in the php configuration settings file.Put this before any of the code on contact.php <? ob_start() ?> And put this after all the code on contact.php<? $o=str_replace("<a",'<a target="_blank"',ob_get_contents()); ob_end_clean(); echo $o; ?> Edited June 7, 2009 by galexcd (see edit history) Share this post Link to post Share on other sites
BCD 1 Report post Posted June 7, 2009 Hey, thats exactly what I needed. The PHP method works charmingly. Thanks a ton galexcd, you saved my day. Thanks once again.? Share this post Link to post Share on other sites