jquerymobile changepage 无法加载外部js文件解决办法
2013-02-01 15:47
706 查看
"
jQuery Mobile does not pull the whole page into the dom, it grabs the first
So any scripts in the
I generally put all the functional JavaScript for my site on the index page and then when external pages are loaded into the dom they can benefit from the already loaded scripts.
Also, you can place JavaScript code inside the
UPDATE
A good system for this is to put all of your JS into an include file and include it on each page of the site. It will be ignored if pages are brought into the DOM by AJAX, but if someone refreshes somewhere in your site, the JS will be available.
"
基本思想就是把<script src="***.js"></script>,放到body标签里,jquery.mobile.changepage()在加载页面的时候,就会把外部文件加载近来
用location.href = "***.html",可以加载外部js文件
原文链接:http://stackoverflow.com/questions/7449402/jquery-mobile-mobile-changepage-not-loading-external-js-files
jQuery Mobile does not pull the whole page into the dom, it grabs the first
data-role="page"element and its descendants and pulls that into the current dom.
So any scripts in the
<head>of the document will not be included.
I generally put all the functional JavaScript for my site on the index page and then when external pages are loaded into the dom they can benefit from the already loaded scripts.
Also, you can place JavaScript code inside the
data-role="page"element and it will be included when jQuery Mobile does its AJAX load of the page.
UPDATE
A good system for this is to put all of your JS into an include file and include it on each page of the site. It will be ignored if pages are brought into the DOM by AJAX, but if someone refreshes somewhere in your site, the JS will be available.
"
基本思想就是把<script src="***.js"></script>,放到body标签里,jquery.mobile.changepage()在加载页面的时候,就会把外部文件加载近来
用location.href = "***.html",可以加载外部js文件
原文链接:http://stackoverflow.com/questions/7449402/jquery-mobile-mobile-changepage-not-loading-external-js-files
相关文章推荐
- 解决three.js加载外部obj文件在chrome浏览器中无法显示的问题
- Django 无法加载静态文件(js,css,image)解决办法
- jquery easyui easyloader加载外部js文件失败问题解决
- Spring Mvc 无法加载js、css文件解决办法【待补充其他优雅的方法】
- myeclipse9对导入的jquery.js文件报错——解决办法
- 外部调用JS文件时出现中文乱码的解决办法
- javascript中动态加载js文件多种解决办法总结
- apache 下 图片显示不完整 JS文件加载不完全的解决办法
- 外部串口B加载后,会造成ActiveSync软件无法连接的解决办法
- Asp.net应用程序引入外部JS文件,JS中的中文字符乱码解决办法
- django 解决css,js文件304导致无法加载显示问题
- bootstrap 模态窗口 第二次无法加载js 的解决办法
- 关于JQuery加载本地JSON文件无法读取(权限不足的)解决
- 导入外部JS文件时出现乱码的解决办法
- Eclipse中Jquery等js文件报错的解决办法
- myeclipse9对导入的jquery.js文件报错——解决办法
- jquery 异步加载数据引起的js注入解决办法
- 关于UML工具的.bin文件无法加载的解决办法
- ajaxfileupload.js上传文件时jQuery.handleError is not a function的 解决办法
- struts1的.do页面无法加载外部的js文件