View Full Version : HELP on F5 (Refresh)
Yovav
12-17-2002, 11:35 AM
Hi all,
How can I tell my browser to go to a specific page when user do Refresh
maybe there's something like:
javascript:window.history.???
or
javascript:location.href='Current_Page.html' (when refreshed)
so I can determin different "home" page for every page,
(I need this coz I run this web from one big frame)
I know the syntax for back:
javascript:window.history.forward(0); // Disable getting back to this page
anyway, I can't remember the syntax for Refresh
:-(
beetle
12-17-2002, 04:57 PM
Well, there are three common ways to refresh the browser. Since you can't natively detect a refresh (that's why you can't remember the syntax, there isn't any!), you must attempt to detect each method.
1. Hit the F5 key. This can be prevented.
2. Right-click (or Shift+F10), select 'Refresh'. This can be prevented.
3. Click the 'Refresh' or 'Reload' button on the browser. This cannot be prevented.
So, assuming each method is used equally, you can achieve about 67% coverage. Now, more realistically, most people still use #3, and both #1 and #2 won't operate if javascript is disabled, so your acutal coverage is probably 40%-50%.
Is it worth it?
Describe your problem with a bit more detail and I'm sure an alternate solution can be found.
Yovav
12-17-2002, 08:02 PM
I have a web that first loads "index.html"
it actually open the web with 100% width and 100% height
<FRAMESET BORDER="0" rows="100%">
<FRAMESET BORDER="0" cols="100%">
<FRAME NAME="Content" SRC="Default_H.asp" SCROLLING="NO" target="_self">
</FRAMESET>
</FRAMESET>
now - if I go from main page to other pages,
I have this Refresh problem,
it only goes back to the main page (index.html)
what I had in mind is to fool the browser and tell him
that he came from other page (not index.html)
so I can actually stay in the page I'm on when Refreshing
hope U got it :-)
ConfusedOfLife
12-17-2002, 08:06 PM
The third way can be prevented too! Open your new page by window.open and use toolbar=no !!!
Ok, sorry! Just joking! probably the worse way, but I think what you're looking for is impossible or just drives your viewers mad!
beetle
12-17-2002, 08:27 PM
Why do you have your site in a frameset with only one frame? That kinda defeats the puropse of frames...
Yovav
12-17-2002, 10:38 PM
That way - the users do not see the address (file name)
when I move from page to page...
exp:
they see http://www.myaddr.com
and not:
http://www.myaddr.com/index.html
or
http://www.myaddr.com/someOtherFile.html
beetle
12-17-2002, 10:58 PM
Well, you really are mis-using frames then, aren't ya? :D
Seriously, the problem you describe is a drawback of using frames, and at the moment I can't think of a solution.
Skyzyx
12-17-2002, 11:03 PM
One thing you could do is use cookies to get around your problem. You could write a script using session-only cookies where if you are viewing a page within the 100%x100% frame, it will set a cookie. You can script the main frame page to load that particular page as long as the browser is open... meaning that it won't start you back at the beginning if you refresh the browser.
That's my idea anyways.
whammy
12-18-2002, 01:42 AM
I agree with most of the above statements... ditch the frames... they should only be used if absolutely necessary (for some reason I can't imagine). :)
glenngv
12-18-2002, 02:00 AM
It CAN be done! :D
<html>
<FRAMESET BORDER="0" rows="100%">
<FRAMESET BORDER="0" cols="100%">
<FRAME NAME="Content" SRC="Default_H.asp" SCROLLING="NO" target="_self">
</FRAMESET>
</FRAMESET>
<script language="javascript">
if (top.name) top.frames["Content"].location.href=top.name;
</script>
</html>
then in each of your html pages, put this line inside the script tag in the head:
top.name=location.href;
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.