[Solved] jquery mobile popup leads to different page on close
Hello everybody,
I am new to jquery mobile and I have following problem:
I have 2 pages in two different html files - root page and settings page - in my root page i display popup, but when I close popup by escape or clicking outside popup I am redirected to settings page.
Could anyone please tell me what am I doing wrong?
EDIT:
After some digging inside jquery js I have found out solution - I have to set history option of popup to false and then it closes normaly.
Here is code of my root page:
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Root page</title>
- <link rel="stylesheet" href="css/jquery.mobile-1.2.0.css" />
- <link rel="stylesheet" href="css/rieter-mobile.css"/>
- <link rel="stylesheet" href="css/my.css"/>
- <script type="text/javascript" src="js/jquery-1.8.2.js"></script>
- <script type="text/javascript" src="js/jquery.mobile-1.2.0.js"></script>
- <script type="text/javascript" src="js/jquery.tmpl.js"></script>
- <script type="text/javascript" src="js/my.js"></script>
- </head>
- <body>
- <script type="text/javascript">
- function checkWebSocket(){
- $("#popupDiv").popup();
- if ("WebSocket" in window){
- $("#popupDiv p").text("Websockets are supported.");
- }else{
- $("#popupDiv p").text("Websockets are not supported.")
- }
- $("#popupDiv").popup("open")
- }
- $(function(){
- checkWebSocket();
- })
- </script>
- <div id="root_page" data-role="page">
- <div id="header" data-role="header" data-position="fixed" data-theme="b">
- </script>
- <h1>Root page</h1>
- <div data-role="navbar">
- <ul>
- <li><a href="/" class="ui-btn-active ui-state-persist" data-prefetch>Home</a></li>
- <li><a href="/settings" data-prefetch>Settings</a></li>
- </ul>
- </div>
- </div>
- <div id="popupDiv">
- <p></p>
- </div>
- <div id="footer" data-role="footer" data-position="fixed" data-theme="b">
- <h3>2012 © Foo</h3>
- </div>
- </div>
- </body>
- </html>