新页面加载时未检测到js和CSS [英] js and css is not detects when new page loads

查看:93
本文介绍了新页面加载时未检测到js和CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在phonegap(3.4)应用程序中,我们使用jquery加载功能进行导航.它将导航,但是不会从index.html文件中检测到页面js和css文件.因此,我们需要将其附加在每个页面的顶部,如果要通过js函数浏览某个页面,则需要通过jquery getScript方法获取js文件.还有其他简单的方法可以做到这一点. 这是index.html代码

In our phonegap(3.4) application we are using jquery load function for navigation. It will navigate but that page js and css files are not detect from index.html file. so we need to attach it on top of every page and if we are navigate some page by js function so with that we need to get js file by jquery getScript method. Is there any other easy way to do this. this is index.html code

> <!DOCTYPE HTML> <html>             <head>                  
>     <meta charset="UTF-8">                      
>     <title>index        
>     </title>                      
>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">                          
>     <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,
> user-scalable=no" />                                           
>     <link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.2.css">                              
>     <link rel="stylesheet" type="text/css" href="css/style.css">                                  
>     <link rel="stylesheet" type="text/css" href="css/mobilestyle.css">                                                                   
>     <link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.2.css">                                   
> 
>     <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>                                
> 
>     <script type="text/javascript" src="js/jquery.mobile-1.4.2.min.js"></script>                         
> 
>     <script type="text/javascript" src="js/global.js"></script>                                         
>     <script type="text/javascript" src="js/cordova.js"></script>                                         
>     <script type="text/javascript" src="js/DBDatabase.js"></script>                                         
>     <script type="text/javascript" src="js/DBDatabase.js"></script>                                                                            
>     <script src="js/index.js"></script>                                                                              
>     <script type="text/javascript">
>         if(navigator.userAgent.match(/Windows Phone/i)){var Path = "www/";}
>     </script>                                                     </head>             <body>                  
>     <div data-role="page" id="container" data-disable-page-zoom="true">                          
>       <div id="mainContainer">                                           
>       </div>                  
>     </div>                                  </body> </html>

推荐答案

我遇到了同样的问题.当我将其更改为不带BOM的UTF-8时,它已得到修复.检查您的js文件,所有文件都必须是相同的数据类型.通常它们是没有BOM的UTF-8

I got same problem. It had been fixed when I change it was UTF-8 without BOM. Check your js files, all of them must be same data type. Usually they are UTF-8 Without BOM

这篇关于新页面加载时未检测到js和CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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