Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 12-10-2006, 09:42 AM   #1 (permalink)
Junior Member
 
Join Date: 12-10-06
Location: Saint Louis
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

Vidra is liked by many
How to make a page open at the top after refreshing/reloading by browser?

Hello all,

I am new, and this is probably a beginner's question. My page opens correctly at the top when called by url. However, when I use the browser's refresh (reload) button, it opens at the anchor that was used last.

Can anyone say how to force a page to open at the top every time?

Thanks in advance.

Andjelko

PS. I would put my page address here, to show what it does, but it seems that that is frowned upon here ...??
Vidra is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-15-2006, 01:53 PM   #2 (permalink)
Member
 
Join Date: 08-02-06
Posts: 39
iTrader: 0 / 0%
Latest Blog:
None

tosaha is liked by many
Could I ask why you wouldn't want the reload to bring the user back to the previous anchor?
tosaha is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-15-2006, 04:55 PM   #3 (permalink)
Senior Member
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 663
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
If the user went to page:

somedomain.com/somepage.html

and clicked on an internal anchor:

somedomain.com/somepage.html#someanchor

and then refreshed the page, the refresh would request:

somedomain.com/somepage.html#someanchor

which is why it jumps to the same position in the page. That's the nature of refresh/reload ... get whatever is in the address bar, again. You can't do anything about that from your end except to fool the visitor into thinking they are doing a refresh when they are really reloading the raw page without the anchor reference, like:

<a href="somepage.html">Refresh This Page</a>

That's about all you've got. If they use their browser's refresh/reload button, it's in the hands of the browser.

<edit>
Using Javascript, you could add an event trigger that detects a reload event, like setting a cookie and checking for the same page request then modifying that request to go to the root page, or something. But there is no "onreload" Javascript event to grab, and onunload is unsatisfactory for this (happens both on a refresh and when they click a link to another resource or type something else into the address bar). You can force a reload using "location.reload()", but that doesn't detect a user refresh, so ...
</edit>

Last edited by StupidScript; 12-15-2006 at 05:03 PM..
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-17-2006, 07:31 PM   #4 (permalink)
Junior Member
 
Join Date: 12-10-06
Location: Saint Louis
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

Vidra is liked by many
Thanks

Thanks to StupidScript and tosaha for their replies.

If I stop and think about it, I guess I don't really need to have the page open at the top when it is reloaded. I guess I concentrated too much on the fact that I did not know how to do it, so I tried to find out how.

But, if that is a) not necessary, and b) not easy to do or even not possible, then - thanks, all is well.

Regards,

Andjelko
Vidra is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make your site cross browser compatible in 5 steps OnyxDesign Web Design Lobby 7 03-27-2008 09:54 AM
open source like Facebook. How difficult is to make open source..? ernest1a Web Design Lobby 4 09-06-2007 07:42 AM
Cross browser issue. Fixes on page refresh Mr.Bill Coding Forum 3 08-13-2007 01:13 AM
How to make BckGrn image resize to browser window? seonewbee Web Design Lobby 4 07-19-2005 11:47 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 03:57 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.