[英]JQuery Mobile 1.4.5 does not seem to invoke javascript on ipad
Using JQuery mobile 1.4.5 ( https://jquerymobile.com/ ) 使用JQuery mobile 1.4.5 ( https://jquerymobile.com/ )
Ironically, everything works on desktop browsers, but I cannot seem to get anything to work when testing on an iPad ... 具有讽刺意味的是,一切都可以在桌面浏览器上运行,但是在iPad上进行测试时,我似乎无法正常工作...
My stripped down page (HTML) contains the following: 我的精简页面(HTML)包含以下内容:
<div data-role="content">
<script src="test.js"></script>
<script>
$( document ).on( 'pagecreate', function( event ) { do_something(); });
</script>
</div>
The file "test.js", contains the following code: 文件“ test.js”包含以下代码:
function do_something() {
alert('here in do_something()');
}
When testing on an iPad, all I get is a grey circle with a "spinning comet" rotating around in the circle and the page never even renders (Yes, I tried rebooting the iPad, clearing browser history/data, etc). 在iPad上进行测试时,我得到的只是一个带有“旋转彗星”的灰色圆圈,该圆圈在圆圈中旋转,页面甚至从未呈现(是的,我尝试过重新启动iPad,清除浏览器历史记录/数据等)。
On all other browsers, I get the alert. 在所有其他浏览器上,我得到警报。
Ultimately, I am trying to load google maps into the page along with the javascript I need to manipulate various DOM elements as well as manipulate the map -- which I CAN do and is working on all other browsers -- just can't seem to get anything to work when testing on an iPad (I do not know how to view source or console messages via iPad Safari, which makes debugging a nightmare). 最终,我试图将google map以及需要操作各种DOM元素以及javascript的javascript加载到页面中-我可以做到并且正在所有其他浏览器上工作-似乎似乎无法在iPad上进行测试时,任何事情都可以工作(我不知道如何通过iPad Safari查看源消息或控制台消息,这使调试成为噩梦)。
ANY suggestions would be helpful. 任何的意见都将会有帮助。
Thanks in advance. 提前致谢。
First of all, you missed some important information like, were "all other browsers" running on your desktop machine or are we talking about other mobile devices? 首先,您错过了一些重要信息,例如台式机上是否正在运行“所有其他浏览器”,或者我们是否在谈论其他移动设备? This is extremely important.
这是非常重要的。
As you can see spinner that would mean jQuery Mobile and jQuery are loaded. 如您所见,微调器意味着将加载jQuery Mobile和jQuery。
If they were successfully running on your desktop computer then you may check these: 如果它们已在您的台式计算机上成功运行,则可以检查以下内容:
Thanks to all who provided some insight... 感谢所有提供了一些见解的人...
Turned out it was an external javascript file that contained a try/catch block as: 原来,这是一个外部的javascript文件,其中包含try / catch块,如下所示:
try {
// code
}
catch {
// code
}
When changed to: 更改为:
try {
// code
}
catch(err) {
// code
}
... after the change was made, all tests passed !! ...进行更改后,所有测试都通过了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.