homepage Welcome to WebmasterWorld Guest from 54.196.196.62
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
anchors within iframe with Firefox
anchors won't work within iframe with Firefox
Izzy




msg:4289480
 1:26 pm on Mar 30, 2011 (gmt 0)

Hello all,


I have a problem with simple anchors. The page that contains the anchors is in an iframe. It works fine with IE and Safari but won't work with Firefox 4.0.
The code I use:
<a href="#anchor">to anchor</a>
<a id="anchor"></a>

I know it's an iframe problem. The page works fine with Firefox if the page in question is not within an iframe. Does anybody know a solution to my problem or a work around.

-Thanks.

 

incrediBILL




msg:4289498
 2:05 pm on Mar 30, 2011 (gmt 0)

Hi Izzy and welcome to WebmasterWorld.

It's not an iframe thing, it's an anchor attribute thing.

Try using the "name" attribute and it might work properly: <a name="anchor"></a>

Izzy




msg:4289530
 3:20 pm on Mar 30, 2011 (gmt 0)

Hi incrediBILL,

thanks for your quick response. I did try with "name" instead of "id" and still doesn't work. As I mentionned, if I display the page outside the iframe, the anchors works perfectly with Firefox. That's why I thought it was a iframe problem. Could there be some setting with Firefox that I'm not aware of?

Izzy

incrediBILL




msg:4289532
 3:26 pm on Mar 30, 2011 (gmt 0)

Could it be a window focus thing?

Like you need to select the iframe before it works within the iframe?

rocknbil




msg:4289594
 4:45 pm on Mar 30, 2011 (gmt 0)

Did you try it on a non-empty element? It doesn't have to be an anchor.

<a href="#anchor">to anchor</a>
<h2 id="anchor">Topic three</h2>

I just tested it using ID's but don't have 4.0, maybe it's specific to 4.0 - did you validate all documents?

Izzy




msg:4289624
 5:30 pm on Mar 30, 2011 (gmt 0)

Hi Rocknbil,

thanks for your input!

It is a 4.0 thing...Someone I know tested it with a previous version of Firefox and it's workin fine....
I did also try with an non-empty element and with "id' and still doesn't work...I will look into what incrediBILL suggested and see...
Will post the fix if I find one!

incrediBILL




msg:4289636
 5:44 pm on Mar 30, 2011 (gmt 0)

if it's a FF 4 thing I'd go report the bug to them then because I found lots of little quirks in FF 4 and bailed on it.

BTW, why do both of you use the ID attribute instead of the NAME attribute?

I trust W3C's definition of this: [w3schools.com...]

Although ID might work, NAME is what it's always supposed to have been for this purpose if I'm not mistaken.

Izzy




msg:4289701
 7:02 pm on Mar 30, 2011 (gmt 0)

Actually, it's a note I read from the w3school site. They say that the upcoming HTML5 standard suggest using the id attribute instead"...

I'll report the bug to FF 4

rocknbil




msg:4289712
 7:22 pm on Mar 30, 2011 (gmt 0)

Name is deprecated [w3.org] for non form elements in XHTML. It will still work for anchors and don't think it's deprecated in other doctypes, but it's a habit thing for me - name for form elements, id for DOM objects.

incrediBILL




msg:4289753
 8:35 pm on Mar 30, 2011 (gmt 0)

Ah, an HTML 5 thing, good to know.

You can see how I'd be confused with the W3C docs I linked which are currently coming to the top for the query ;)

I know what I know if you know what I mean, and now I know more!

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