弹出窗口不在jQuery Mobile中打开 [英] popup window not open in jquery mobile

查看:113
本文介绍了弹出窗口不在jQuery Mobile中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了一个脚本来阻止我的移动应用程序中的链接在我的ipad上。



它可以正常工作,但我现在遇到了弹出窗口问题移动。



问题是当我使用这个脚本时,弹出式窗口不会再打开。



我可以做些什么来打开弹出窗口?



脚本:

 (函数(文档,导航器,独立){
//防止移动Safari中的应用程序链接操作
//此JavaScript必须是< head>
中的第一个脚本if((在导航器中独立)&& 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;
}
//只有链接到您自己的应用程序时才会这样做
/ /如果你想要所有的链接,可以使用if('cref ='href')。
if('href'in curnode&&(curnode.href.indexOf('http')||
〜curnode.href.indexOf(location.host))){
e.preventDefault();
location.href = curnode.href;
}
},false);
}
})(document,window.navigator,'standalone');


解决方案

解决了问题...



我做了什么:

instad使用我上面写过的脚本,我只用这个< a href =>< / a>

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

当我在全屏模式下看到我的应用程序时,这允许我进行浏览。在浏览器中打开它,在我的应用程序中加载页面。


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

解决方案

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.

这篇关于弹出窗口不在jQuery Mobile中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆