IFRAME In New Window


I have some link like this:

<a href="<?php echo $item[‘link’]; ?> My Title Link </a>

I need this link will open with iframe in diffrent page in my site.

So, now im in page - page1.html
when i click on the link my link will open in doffrent page: page2.html, in this page (page2.html) can see the link in iframe…

Hope you can understand…

You’ll have a better chance of getting a response in the HTML forum, since this has more to do with new windows or iframe.

A little bit of a better explanation will help as well.

BTW: You’re code is missing the closing double quote for href and the closing bracket following that.

<a href="<?php echo $item['link']; ?>"> My Title Link </a>

You also need to include the target attribute. Which is not valid in xhtml

So instead of using invalid code, the change of behaviour for the link (open in a new window, not the current one) should be done via javascript instead.

target is valid for the a tag in the current specs for HTML 5 (a reversal from previous considerations). XHTML is dead and has been discontinued, what it does and does not support shouldn’t be a consideration moving forward in my opinion particularly since I’ve never seen one site use the protocol correctly anyway.

If you stay with HTML 4 and HTML 5 then the target attribute is okay to use.

It’s only when you choose to use XHTML that the target attribute should not be used.


XHTML is dead. Gone. Berift of life it has gone to meet it’s maker and joined the choir eternal. There’s no longer a reason to consider it - and its not like anyone used it right anyway.

If you send your documents with the text/html header they are html documents. The browser activates the html rendering engine and every single element gets an innerHTML attribute. If you use a meta tag to then declare the document to be xhtml it’s too late - the innerHTML attribute persists.

Without that attribute jQuery, prototype, YUI and mootools DO NOT WORK. PERIOD. And if you send a document with the correct header for xhtml:


Internet Explorer will not render the page AT ALL. It will only show a document tree.

Sending the document as text/html to placate IE and then following XHTML rules just creates a jumble that isn’t valid code for XHTML or HTML. Those /> closes in XHTML – NONE of them are valid HTML.

Browsers don’t choke on this stuff because browsers are about the most tolerant computer programs in existence for programmer flub ups. But when you flub up Browser A may deal with it one way, Browser B another - there’s no standard.

The push for web standards isn’t on the browser makers alone. If we want faster pages, faster browsers and the like we have got to start sending pages that are syntactically correct down to the last letter. HTML 4.01 Strict is currently the only universal means of doing this, HTML 5 is coming. XHTML is dead. Microsoft has made it clear they have no intention of ever supporting it as intended - and unless that changes or IE drops off the face of the map (far more unlikely) the format is dead.

Which is a shame because XHTML, particularly XHTML 2, had some wonderful ideas in it. But the W3C has discontinued it. It’s dead. As. A. Doornail.