ubiquibacon
ubiquibacon

Reputation: 10677

How to link directly to a specific spot in an iFrame?

I have a page located at:

http://localhost:8080/job/demo/865/parsed_console/?

Inside that page is an iFrame:

<iframe width="100%" scrolling="auto" height="600" frameborder="0" src="job/demo/865/parsed_console/log.html"></iframe>

Within the iFrame there are anchor tags which I can browse to with a link like the one below:

http://localhost:8080/job/demo/865/parsed_console/job/demo/865/parsed_console/log_content.html#ERROR1

The problem is that if I use the above link I am directed to a page that does not have the outer frame. I don't have source control over either page.

How can I make a link that will go directly to a specific location in the iFrame without losing outer frame?

Upvotes: 1

Views: 1033

Answers (4)

ScottJaxon
ScottJaxon

Reputation: 21

Look for an id tag in the html page at the specific spot you want the iFrame to open at. Then hash tag it in your iFrame

For instance the page you load in your iFrame may have - id="autolog" - or - input id="un"- etc.,

Hash tag the id in your iFrame like so:

<iframe src="https://sitethatloadsiniFrame.com#slogin;" frameborder="0" height="98"
width="225" style="float: right; frameborder="0"; SCROLLING=YES></iframe>

Upvotes: 0

Yaniro
Yaniro

Reputation: 1587

In your link add a target attribute for example: <a href="..." target="name_of_iframe"/> where name_of_iframe the value of the name attribute on the iframe tag for example: <iframe name=name_of_iframe"></iframe>

Upvotes: 0

Justin Martin
Justin Martin

Reputation: 993

I believe the solution to this is to change the src attribute of the iframe element to include the fragment which you wish to scroll into view. This would be achieved using Javascript.

Upvotes: 1

Etienne Dupuis
Etienne Dupuis

Reputation: 13806

http://localhost/ is only visible from your computer.

<iframe name="blah"></iframe>


<a href="http://www.yahoo.com" target="blah">

Upvotes: 0

Related Questions