popup window not open in jquery mobile

此生再无相见时 提交于 2019-12-25 18:37:25

问题


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');

回答1:


In this case, you need to open it programmatically.

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



回答2:


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.



来源:https://stackoverflow.com/questions/16972940/popup-window-not-open-in-jquery-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!