View Full Version : Opera won't take me to the top
Paul Komski
02-05-2003, 07:48 PM
<a href="#top">Back to top of page</a>
Has always worked (although its undocumented as far as I know), in all browsers I have tried so far, to take one back to the top of the current page; that is until Opera 7.0. In fact just href="#" (or any non-existent bookmark/anchor) seems to have done the same thing in the past.
Opera7 does nothing when you click on the link unless one inserts the equivalent anchor at the top of the page. eg:-
<a name="top"></a> in the first paragraph under the body tag.
Since the pages WITHOUT the top anchor still validate as HTML 4.01 (Strict) does anyone know if this is an Opera bug or is Opera being super-strict?
It's just a nuisance to have to go back and insert a load of #top anchors if it's just a bug waiting to be fixed. Not had time to tryout Opera 7.01 yet though.
sleddog
02-06-2003, 05:53 AM
'a_href="#top"' means reload the current page and position it to the anchor 'a name="top"'. "top" itself does not have any special meaning in HTML specifications; it does not automatically refer to the top of page. So if you use 'a_href="#top"' without a corresponding anchor tag then you are depending on the browser's error-correction to interpret what you actually mean. Different browser have different error-correction code. Opera has considerably less than the big two (a fact which is reflected in it's size).
It is generally not a good idea to code webpages in a way that depends on a browser's error-correction techniques. Such techniques are unpredictable and may change. This is not a bug in Opera, so I wouldn't wait for it to be fixed :)
Paul Komski
02-06-2003, 06:25 PM
Thanks sleddog. Just thought it would have been picked up when verifying the pages.
My first tag under body is a div and just renaming this to:-
<div id="top">
works nicely too (and combines well with the css as well).
sleddog
02-06-2003, 08:43 PM
Originally posted by Paul Komski
Thanks sleddog. Just thought it would have been picked up when verifying the pages.
You're welcome (gosh, aren't we polite here? :) )
< a href="#top" > won't be picked up by a validator because it's perfectly correct HTML usage. An HTML validator does not check to see if your links are broken -- and basically that's what it is, a broken link (in the absence of an < a name=... > tag on the same page).
I'm not sure what you are doing with the < div id... > Could you explain further?
An easy way of making a link to reposition the current page at the top is < a href="pagename.html" > where of course pagename.html is the name of the current page.
Paul Komski
02-06-2003, 08:53 PM
He He - I suppose that IS exactly what it is!
sleddog
02-06-2003, 08:55 PM
And I was editing my post while you were posting :)
Paul Komski
02-06-2003, 09:16 PM
The Div and id business. Using CSS I already had a number of different Div classes.
(div id="topcontent"), (div id="leftborder"), (div id="main") etc, with properties for these set differently for each in a css file.
In fact all I did was to rename href="#top" to href="#topcontent" (just quicker than changing the div tag on all the pages as well as the css file entries to div #top).
Since div happened to be the first tag after body I used its id but one could assign an id to p or h1 etc etc and it would work the same. In other words a "bookmark/anchor" can be either an anchor tag or a class id.
PS Trouble with using an absolute link would be that the page might want to reload.
The other thing I have done in the past, (which has worked) but maybe undocumented too, is to for example use (a href="http://www.americanexpress.com" target="_top") in order to break out of a frame - but maybe that's using an error as well??
sleddog
02-07-2003, 08:29 AM
Originally posted by Paul Komski
In other words a "bookmark/anchor" can be either an anchor tag or a class id.
Very interesting; I didn't know that. Thanks!
PS Trouble with using an absolute link would be that the page might want to reload.
Ah, but that's where intelligent browser caching comes into play. Depending on your cache settings, you'll probably find that Opera will immediately reload the page from RAM cache. Other browsers will re-check the page on the web.
The other thing I have done in the past, (which has worked) but maybe undocumented too, is to for example use (a href="http://www.americanexpress.com" target="_top") in order to break out of a frame - but maybe that's using an error as well??
No that is legitimate. When working with frames there are a few pre-defined 'special' targets like _TOP and _SELF
vBulletin v3.6.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.