[英]Jquery not loading script tags to load libraries
i have a html page where i am creating a new window. 我有一个html页面,我正在其中创建一个新窗口。
var newwindow = window.open();
$(newwindow.document.head).load('/Viewer/html/imageLibraries.html');
$(newwindow.document.body).html("<h1>Its a new page :D</h1>") ;
My imageLibraries.html is like this 我的imageLibraries.html就是这样
<meta charset="utf-8">
<link href="../css/new_kendo.css" rel="stylesheet">
<link href="../css/style.less" rel="stylesheet/less">
<script type="text/javascript" src="Viewer/libs/angular.min.js"></script>
<script type="text/javascript" src="Viewer/libs/less.js"></script>
<script type="text/javascript" src="Viewer/libs/jquery-1.8.3.min.js"></script><!--JQuery library-->
<script src="Viewer/libs/jquery-ui.min.js"></script><!--Jquery library -->
<script src="Viewer/libs/ImageViewer.js"></script><!--JQuery library for Imageviewer-->
<script src="Viewer/libs/kendo.all.min.js"></script><!--For Kendo Functionality -->
<script src="Viewer/libs/jquery.mousewheel.js"></script><!--JQuery library for use mouse event-->
<script src="Viewer/js/app.js"></script>
<script src="Viewer/js/directives/directives.js"></script><!--directive for iviewer-->
The problem is, the css files are loading fine but the script tags are not loading In the console the DOM tree is like this 问题是,css文件可以很好地加载,但是脚本标记不能加载。在控制台中,DOM树是这样的
<head><meta charset="utf-8">
<link href="../css/new_kendo.css" rel="stylesheet">
<link href="../css/jquery.iviewer.css" rel="stylesheet">
<link href="../css/style.less" rel="stylesheet/less">
<!--JQuery library-->
<!--Jquery library -->
<!--JQuery library for Imageviewer-->
<!--For Kendo Functionality -->
<!--JQuery library for use mouse event-->
<!--directive for iviewer--></head>
Can someone suggest what to do ? 有人可以建议该怎么做吗?
The issue is probably to do with the use of .load()
? 问题可能与使用.load()
?
https://api.jquery.com/load/ https://api.jquery.com/load/
Script Execution 脚本执行
When calling .load() using a URL without a suffixed selector expression, the content is passed to .html() prior to scripts being removed. 使用不带后缀选择器表达式的URL调用.load()时,将在删除脚本之前将内容传递给.html()。 This executes the > script blocks before they are discarded. 这将执行>脚本块,然后将其丢弃。 If .load() is called with a selector > expression appended to the URL, however, the scripts are stripped out prior to > the DOM being updated, and thus are not executed. 但是,如果使用附加到URL的选择器>表达式调用.load(),则脚本将在更新DOM之前被删除,因此不执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.