Question: Is it possible to detect a page refresh within a Jquery mobile HTML5 page?

I am building a quiz as part of a client project - the quiz navigates through jquery mobile div pages within the one html page.. so for example if the user was on index.html#quizpage3 and refreshed I would like to detect the refresh and return the navigation to index.html.

Is this possible?

Cheers
Paul

Answer: 
Well this is a start, each time you navigate to another page you should get the refresh console log:

* <http://jsfiddle.net/nkZQQ/5/>

JS

```
$("div:jqmData(role='page')").live('pagehide',function(){
    console.log('page refreshed, redirect to home');
    $.mobile.changePage( "#home", { transition: "slideup"} );
});​

```

HTML

```
<div data-role="page" id="home">
    <div data-role="content">
        Hello Refresh
        <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f">
            <li data-role="list-divider">Home</li>
            <li><a href="#page2">Page 2</a></li>
        </ul>
    </div>
</div>

<div data-role="page" id="page2" data-theme="a">
    <div data-role="content">
        Hello Page 2
        <ul data-role="listview" data-inset="true" data-theme="a" data-dividertheme="a">
            <li data-role="list-divider">Page 2</li>
            <li><a href="#home">Home</a></li>
        </ul>
    </div>
</div>​

```

Maybe another event would work better:

* <http://jquerymobile.com/demos/1.1.0/docs/api/events.html>
You could grab the URL with in your `$(function() {});` method (which only runs on page load), and if it contains a **#** then redirect to Home Page.

*Edit: or use `window.onload = function ...` as a pure JS alternative.*