|
我用wex5服务端打包一个全部是html5文件的网站。里面加载的都是些图片,通过js+xml调用。在本地直接预览和上传到服务器预览都可以正常。
当我用wex5打包后,用http://localhost/index.html访问的时候,可以加载出页面效果,但是在遇到需要加载config.xml文件的时候,就无效了。尝试过更改index.html 加<meta http-equiv="Access-Control-Allow-Origin" content="*">解决跨域问题。但是加了也不凑效。
请高手指点一下。谢谢。
index.html具体代码是这样的。
- <!DOCTYPE html>
- <html>
- <head>
- <title>京润珍珠文化馆欢迎您</title>
- <meta http-equiv="Access-Control-Allow-Origin" content="*">
- <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui, user-scalable=no" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <meta http-equiv="x-ua-compatible" content="IE=edge" />
- <style type="text/css">
- @-ms-viewport { width:device-width; }
- @media only screen and (min-device-width:800px) { html { overflow:hidden; } }
- html { height:100%; }
- body { height:100%; overflow:hidden; margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#FFFFFF; background-color:#000000; }
- </style>
- <script type="text/javascript" src="tour.js"></script>
- <script type="text/javascript" src="files/jquery183.js"></script>
- <link rel="stylesheet" type="text/css" href="files/colorbox1514/colorbox.css" />
- <script type="text/javascript" src="files/colorbox1514/colorbox.js"></script>
- <script type="text/javascript" src="files/utility.js"></script>
- <script type="text/javascript">
- // 加载xml文档
- function loadXML(xmlFile) {
- var xmlDoc;
- try {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- } catch(e) {
- try {
- xmlDoc = document.implementation.createDocument("", "", null) ;
- } catch(e) {}
- }
- try {
- xmlDoc.async = false;
- xmlDoc.load(xmlFile);
- } catch(e) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", xmlFile, false);
- xhr.send(null);
- xmlDoc = xhr.responseXML.documentElement;
- }
- return xmlDoc;
- }
- var xmlDoc = loadXML("config.xml");
- //获取热点配置数据,弹开对应商城页面
- function showWindow(hotspot) {
- var colorboxURL, tColorbox;
- if(xmlDoc != null) {
- var root = xmlDoc.documentElement;
- var cmxspot=root.getElementsByTagName("cmxspot");
- for(var i=0; i<cmxspot.length; i++) {
- if(cmxspot[i].getAttribute("name") == hotspot) {
- colorboxURL = cmxspot[i].getAttribute("url");
- tColorbox = cmxspot[i].getAttribute("title");
- tColorbox = tColorbox.replace("点击查看","");
- resizeColorbox();
- if(!colorboxInstalled) {
- colorboxInstalled = true;
- $.colorbox({
- iframe: true, href: colorboxURL, reposition: true, opacity: 0,
- width: wColorbox, height: hColorbox, title: tColorbox,
- onClosed: function() {colorboxInstalled = false}
- });
- }
- }
- }
- }
- }
- //打开360旋转层
- function open360(hotspot) {
- $.colorbox.remove();
- colorboxInstalled = false;
- resizeColorbox();
- colorboxInstalled = true;
- $.colorbox({
- iframe: true,
- href: "360/index.html?spot=" + hotspot,
- reposition: true,
- width: wColorbox,
- height: hColorbox,
- title: "展品360播放器",
- onClosed: function() {colorboxInstalled = false;}
- });
- }
- </script>
- </head>
- <body>
- <div id="pano" style="width:100%;height:100%;">
- <noscript><table style="width:100%;height:100%;"><tr style="vertical-align:middle;"><td><div style="text-align:center;">ERROR:<br/><br/>Javascript not activated<br/><br/></div></td></tr></table></noscript>
- <script type="text/javascript">
- embedpano({
- swf:"tour.swf",
- xml:"tour.xml",
- target:"pano",
- id: "krpanoObject",
- wmode: "transparent",
- mwheel: true,
- html5: selecthtml5usage(),
- passQueryParameters:true,
- vars:{htmlsound:''}
- });
- </script>
- </div>
- </body>
- </html>
复制代码 |
|