0

我在一个网站上工作,主页非常重 javascript/jQuery。因此,在加载页面时,移动设备上会出现各种问题。移动 Safari 崩溃并且在其他设备上页面完全冻结。

如果网站检测到您正在使用移动设备,我想知道是否可以禁用外部 javascript 文件。

4

2 回答 2

0

You have two main choices:

  1. At the beginning of the external javascript file, check what kind of device you're on and skip executing the rest of the file if desired.

  2. Don't statically load the javascript file. Instead, check what kind of device and then dynamically load the JS file if not on a mobile device.

That said, what you really ought to do is fix your javascript because there's no reason you can't have javascript that works on both desktop and mobile devices. If mobile Safari is crashing that's because you have issues in your JS that you should fix, not because you can't run JS on mobile Safari.

于 2013-10-08T20:48:25.563 回答
0

感谢您的回复,我可能会尝试选项 1。问题是它通过 Stellar.js 使用视差滚动效果,我听说它不适用于移动浏览器,因为滚动的工作方式不同。

于 2013-10-09T20:57:11.210 回答