...

View Full Version : how to use history and referrer in framestructure?



Flashchick
03-12-2004, 05:04 PM
Hi all,

I have a frame structure (three frames) where the top one is my flash navigation. The navigation itself is quite complex so I have given up on the idea of creating a back button code to control the flash. All I want to do now is to refresh the flash page when browser's back button is pressed.

What I would like to do is to set a variable of the previous page I just have been so when I hit browser's back button I know if this page is the same as the variable. In each individual page i would set the varaible to be the previous page. Here are few things I have tried so far and none of them seems to work (even online!)
(sections is the name of the main frame)

old_page = parent.sections.history.previous;

old_page =document.referrer;

I tried both of them at the beginning of each page. then used onUnload command in the body tag to call a function on another frame where I have the comparison:

function check_history(old_page){

if (old_page == parent.sections.location){

alert(" refresh flash");
}

If I use referrer, the value is null (empty) or if I use history the variable is undefined.

Has anyone come accross with anything similar?

Thank you very much for your help.

joh6nn
03-13-2004, 10:01 AM
could you link us to the page this is on, or show us the complete code you're using? that makes it easier to find problems.

Flashchick
03-15-2004, 10:06 AM
Here is what I have at the Flash html file (top frame called flash)

<html>
<head>
<title></title>
<script language="JavaScript">
<!--


function check_history(old_page){

if (old_page == parent.sections.location){

alert(" i will refresh flash");
}



}
// -->
</script>
</head>

And this is the code I have at the main section (in a frame called sections)

<html>
<head>
<title> </title>
<style>

</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" href="text.css" rel="stylesheet"/>
<script language="JavaScript">

old_page = parent.sections.history.previous;
//old_page =document.referrer I have tried this too.

//-->
</script>
</head>

<body class="body" bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0" onUnLoad ="parent.flash.check_history(old_page)" onLoad="MM_preloadImages('specification_r.jpg','seating_r.jpg','backtotop_r.jpg')">

... plus the content.

This will give me either undifined when I use history or an empty string when I use referrer.

I hope this makes sense.

Thanks.

glenngv
03-15-2004, 10:24 AM
There's no history.previous and document.referrer only works online. Have you tried document.referrer online?

Flashchick
03-15-2004, 10:27 AM
i have tried both of them online and same result.

Flashchick
03-15-2004, 10:42 AM
How can i set the previous page name as a variable using history?

brothercake
03-15-2004, 11:22 AM
Originally posted by Flashchick
How can i set the previous page name as a variable using history?
You can't - you can't read any data from the history object. Referer [sic] is also unreliable - I'm not sending any referer information, and quite a few people don't, for one reason or another.

If you want to reload the flash when the back button is pressed, then maybe you could use on onunload event in the main page, or perhaps you could watch the main page's location, in a timeout from the top frame.

Flashchick
03-15-2004, 11:34 AM
Thanks,

If I use onUnload on the main section and don't compare any variables it will refresh the flash everytime I go to a different page even when using the flash navigation. This is not what I want.

Could you give me some code examples how I could do it with the timeout command?

Thanks.

developercrowd
03-03-2011, 04:55 AM
Thanks,

If I use onUnload on the main section and don't compare any variables it will refresh the flash everytime I go to a different page even when using the flash navigation. This is not what I want.

Could you give me some code examples how I could do it with the timeout command?



Thanks.
<script type="text/javascript">
var past = document.referer;
setTimeout("window.location.href=past","3000");
</script>
this will redirect to 3 secs

Thanks
http://linesforme.blogspot.com



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum