Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how to use history and referrer in framestructure?

    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.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    There's no history.previous and document.referrer only works online. Have you tried document.referrer online?

  • #5
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i have tried both of them online and same result.

  • #6
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How can i set the previous page name as a variable using history?

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by brothercake; 03-15-2004 at 11:24 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #8
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #9
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Hope this helps

    Quote Originally Posted by Flashchick View Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •