简体   繁体   English

从iOS 7主屏幕启动时,Web应用程序JS未运行

[英]Web app JS not running when launched from iOS 7 home screen

I have a webpage which is linked with a bunch of CSS and JS files. 我有一个网页,该网页与一堆CSS和JS文件链接。 The page also has these tags for iOS: 该页面还具有适用于iOS的以下标签:

<meta name="viewport" content="width=320, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

The page works just great when launched from desktop browsers as well as Mobile Safari. 从桌面浏览器和Mobile Safari启动时,该页面的效果非常好。 But, when I add it to home screen and launch from there, the JavaScript files are not executed. 但是,当我将其添加到主屏幕并从那里启动时,不会执行JavaScript文件。 The CSS and images load just fine. CSS和图像加载就很好。

My page links files with relative paths like this: 我的页面使用以下相对路径链接文件:

<script src="js/parallax.min.js"></script> 

I realized the CSS and JS files were being used from cache. 我意识到CSS和JS文件已从缓存中使用。 So I added this to my PHP page, so that the files are loaded every time the page loads. 因此,我将其添加到我的PHP页面,以便每次页面加载时都加载文件。

<script src="js/script.js?cache=<?php echo(rand(1000,9999)); ?>"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM