John Mathison
John Mathison

Reputation: 914

html lint to other page's iframe

I have a page A with 2 links LinkA and LinkB I have a page B with an iFrame iFrameB

I'd like to click on LinkA and go to page B and load in the iFrame a Url and if I click on LinkB do the same but load in the iFrame a different Url.

Is this possible?

EDIT

 Page A
 <a href="????">LinkA</a></div>
 <a href="????">LinkB</a></div>

 Page B
 <iframe width="100%" id="myFrame" src="http://www.default.html"></iframe>

From both links I'd like to open page B but with link a the iFram has to have a different src than when I click LinkB

Upvotes: 0

Views: 94

Answers (1)

Quentin
Quentin

Reputation: 943571

What you are asking for is two different versions of Page B which are almost identical, but have a different value for one attribute.

You could achieve this by simply having a completely separate .html file for each version of page B.

The usual solution for this, however, would be to:

  1. generate Page B using a server side programming language
  2. put all the HTML in a template
  3. make the value of the src attribute a value (e.g. src="[% iframe_url | html %])
  4. use your server side language to examine the query string and set the iframe_url variable conditionally

Then you could link to /pageB?url=1 and /pageB?url=2 (or however you want to express it).

Upvotes: 2

Related Questions