【问题标题】:href attribute in webview IOS with jQuery-Mobile带有jQuery-Mobile的webview IOS中的href属性
【发布时间】:2012-05-07 08:53:16
【问题描述】:

一个简单的代码...

此代码在 html 头标签内。 jquery-mobile 和 jQuery 的 include 是正确的。

$(document).ready(function() {           
    $("a").click(function () {       
       var t = $(this).attr('href');
    });
});

但在 webview IOS 中不起作用,但在 Chrome 中可以正常工作。

【问题讨论】:

  • 你怎么知道它不起作用?它没有做任何事情...将alert('foo) 放入事件中...

标签: jquery ios jquery-mobile uiwebview safari


【解决方案1】:

试试vclick事件:

$(document).ready(function() {
    $("a").vclick(function (){        
       var t = $(this).attr('href');
    });
});

【讨论】:

  • 我找到了解决方案! $(document).ready(function() { //从 Native 执行文件时... $("a").touchstart(function (){ var t = $(this).attr('href') ; alert(t); }); //else if is executed from Web Browser.... $("a").click(function (){ var t = $(this).attr('href');警报(t);});});这很好用!!!谢谢!!!
【解决方案2】:

还没有真正检查过,但 iOS 中的 click 事件的处理(和行为)与桌面对应物有点不同。

你有tried this吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-12
    • 1970-01-01
    • 2012-01-30
    • 2013-06-23
    • 2014-03-15
    • 2012-04-10
    • 2012-01-28
    • 1970-01-01
    相关资源
    最近更新 更多