homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
iframe anchor linking?
linking to anchor within iframe
MediaSVI




msg:4408131
 2:41 pm on Jan 18, 2012 (gmt 0)

Hello all! My 1st post.

I have an iframe embedded on my webpage of a .html manual and I would like to be able to have the manual open to certain anchors within it when a given page on my website is visited.

Here is the iframe code I have that will open up the manual but then the visitor has to scroll to the topic covered:

<iframe name="FRAME1" src="../r6manual/TTM Mixer.14.05.html" width="1100" height="600" frameborder="0" ></iframe>


Here is the anchor code on the TTM Mixer.14.05.html that I would like to be showing when the page is visited.

<div class="Subhead"><a name="468813">Dynamics section</a></div>


Thank you so much for your time,
Matt.

 

tedster




msg:4408277
 7:03 pm on Jan 18, 2012 (gmt 0)

Welcome to the forums, MediaSVI. I think you need to include a page fragment identifier in the iframe's src URL

<iframe name="FRAME1" src="../r6manual/TTM Mixer.14.05.html#468813" width="1100" height="600" frameborder="0" >

And more than that, I'd suggest using the id attribute, not the name attribute, on the actual embedded page:

<div class="Subhead"><a id="468813">Dynamics section</a></div>

MediaSVI




msg:4408306
 7:46 pm on Jan 18, 2012 (gmt 0)

Thanks! It works just fine without changing the name attribute and to change it would be a huge task as this is a manual that I am just embedding into my website so it works just like it would on your desktop.

One thing though is that when I goto the web page the page loads and jumps to the anchor point which is down on the webpage, I would like the page to load and stay at the top how would I do this?

Thank you for your time,
Matt.

tedster




msg:4408326
 8:41 pm on Jan 18, 2012 (gmt 0)

That's the way it works, the browser needs to load the earlier content first. Sometimes the effect is not noticeable but on a slow connection or a very big page it can be very noticeable. If the iframed page is extremely long, maybe you can break it up into sub pages.

MediaSVI




msg:4408335
 9:05 pm on Jan 18, 2012 (gmt 0)

Is there code to load the main page 1st and then load the iframe page?

tedster




msg:4408388
 11:33 pm on Jan 18, 2012 (gmt 0)

I don't think it's worthwhile to try to control that. In my experience, that kind of attempt at control usually ends badly and eats up a lot of time.

Theoretically, it could be possible with JavaScript, I guess... by not even writing the iframe code into the page until the main page is loaded. But that approach is likely to create more usability issues than it resolves, especially cross-device and cross-browser.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved