xmlhttp.send在使用清单文件时抛出异常

时间:2021-01-29 13:47:13

I have a weird problem on Chrome and MobileSafari (works great on IE9)

我在Chrome和MobileSafari上有一个奇怪的问题(在IE9上运行得很好)

I have the following code: var products;

我有以下代码:var products;

function init()
    {
            var xmlhttp;
            if (window.XMLHttpRequest)
              {// code for IE7+, Firefox, Chrome, Opera, Safari
              xmlhttp=new XMLHttpRequest();
              }
            else
              {// code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              }

            xmlhttp.open("GET","ipad/products.php",false);
            xmlhttp.send();
            products = JSON.parse(xmlhttp.responseText);
            //alert(products.products[0].title);
            getProduct(1);
    }

init is called by body onload function.

init由body onload函数调用。

In addition, I use manifest to cache some files:

另外,我使用manifest来缓存一些文件:

<HTML manifest="manifest.php">

now, when I visit the page for the first time - everything works great. after a refresh xmlhttp.send() throws "NETWORK_ERR: XMLHttpRequest Exception 101"

现在,当我第一次访问该页面时 - 一切都很好。刷新后xmlhttp.send()抛出“NETWORK_ERR:XMLHttpRequest Exception 101”

in order to view the page normally again I need to clean the browser cache

为了正常查看页面,我需要清理浏览器缓存

removing the manifest file solves the problem but I need it for offline browsing.

删除清单文件解决了问题,但我需要它进行离线浏览。

anyone knows what is wrong?

谁知道出了什么问题?

Thanks

谢谢

1 个解决方案

#1


1  

well, I solved the problem by adding the following line to manifest.php:

好吧,我通过在manifest.php中添加以下行来解决问题:

NETWORK: *

网络:*

now everything works I guees that the main page was cached too and that caused some problems. on IE it works because it doesn't support manifest files

现在一切正常我猜我的主页也被缓存了,这引起了一些问题。在IE上它可以工作,因为它不支持清单文件

#1


1  

well, I solved the problem by adding the following line to manifest.php:

好吧,我通过在manifest.php中添加以下行来解决问题:

NETWORK: *

网络:*

now everything works I guees that the main page was cached too and that caused some problems. on IE it works because it doesn't support manifest files

现在一切正常我猜我的主页也被缓存了,这引起了一些问题。在IE上它可以工作,因为它不支持清单文件