pageShow event in javascript

后端 未结 10 876
不知归路
不知归路 2020-12-10 05:21

I have the following code:



    
    

        
相关标签:
10条回答
  • 2020-12-10 05:52

    It is a mispell; in the body's tag, the name of the event is "onpageshow" and no "pageshow".

    ...
    <body onpageshow="alert('Done');">
    ...
    

    For IE pageshow event is not supported.

    0 讨论(0)
  • 2020-12-10 05:52

    i'm using FF 4.0.1

    your pageShow event won't fire even in this.

    click here

    for more information

    Update: pageShow fire after pageLoad.

    it's better to use onLoad.

    pageShow should be onpageShow

    0 讨论(0)
  • 2020-12-10 05:55

    From my tests:

    • IE8/9 does not support pageshow/pagehide
    • Chrome12 fires them but doesn't appear to have a page cache - they behave the same as load/unload
    • FF4 supports them as expected
    • iOS on iPad supports them as expected
    0 讨论(0)
  • 2020-12-10 05:59

    Your jQuery code never gets executed. You should run it from within jQuery's "ready" event:

    $( function() {
        $('#mypage').live('pageshow', function (event, ui) {
            alert('This page was just hidden: ' + ui.prevPage);
        });
    });
    
    0 讨论(0)
提交回复
热议问题