简体   繁体   中英

popup window not open in jquery mobile

I have implemented a script to prevent the link in my mobile app on my ipad.

It works fine but I have problem now with the popup I have with jquery mobile.

The problem is when I use this script, the popup window doesn´t open anymore.

What can I do to open the popup window?

The script:

 (function(document,navigator,standalone) {
   // prevents links from apps from oppening in mobile safari
   // this javascript must be the first script in your <head>
   if ((standalone in navigator) && navigator[standalone]) {
     var curnode, location=document.location, stop=/^(a|html)$/i;
     document.addEventListener('click', function(e) {
       curnode=e.target;
       while (!(stop).test(curnode.nodeName)) {
         curnode=curnode.parentNode;
       }
       // Condidions to do this only on links to your own app
       // if you want all links, use if('href' in curnode) instead.
       if('href' in curnode && ( curnode.href.indexOf('http') ||
              ~curnode.href.indexOf(location.host) ) ) {
         e.preventDefault();
         location.href = curnode.href;
       }
     },false);
   }
 })(document,window.navigator,'standalone');

在这种情况下,您需要以编程方式打开它。

$('#popupID').popup('open');

Solved it...

what i have done:

instad to use the script i have write above, i only use this code in the <a href=""></a> .

<a onclick="parent.location='root/example.html'" id="ex"></a>

this allows me when i see my app in the fullscreen mode.. to navigate between the pages without to open it in the browser, the page loaded in my app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM