detecting back link page display event

In all the browsers I've looked, the onload event is not invoked when a page is displayed using a back link.

What is the best way to detect that displaying event?

If you want to try some of your ideas out, I have some code below for you to copy and paste to get you started.
[code]



/*

function loading()
{
alert("loading..");
}

/* ]]> */




Saw the alert?

Click Next page and the back link to see that the onload doesn't happen again.



[/code]

Comments

  • Hi Josh Code,

    This problem is certainly frustrating, especially when my web host is configured to non-parsed headers due to the virtual shared environment... BUT here is your workaround:

    [code]



    /* [color=Red]var loaded = false;[/color]

    function loading()
    {
    [color=Red] if (!loaded){
    loaded=true;[/color]
    alert("loading..");
    [color=Red] }[/color]
    }

    [color=Red]function leaving()
    {
    loaded=false;
    }[/color]
    /* ]]> */




    Saw the alert?

    Click Next page and the back link to see that the onload doesn't happen again.


    [/code]
    Original worked fine on IE7, so I ran it through NS
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion