【问题标题】:WinJS.xhr error while executing second time第二次执行时出现 WinJS.xhr 错误
【发布时间】:2014-02-04 22:31:06
【问题描述】:

测试样本http://code.msdn.microsoft.com/windowsapps/Getting-started-with-310271df

我在 WinJS.xhr 通话中遇到了一些荒谬的问题。如果您第一次运行它,下面的示例可以工作。但是,下次它会给出这个错误!

Exception is about to be caught by JavaScript library 
code at line 2351, column 21 in ms-appx://microsoft.winjs.1.0/js/base.js

0x800c0008 - JavaScript runtime error: The download of the specified 
resource has failed.

If there is a handler for this exception, the program may be safely continued."

现在,如果我删除调试文件夹,它对我来说又可以正常工作了。 如果我安装它,情况也是如此。

【问题讨论】:

  • 我通过添加无缓存的 html 标头解决了这个问题
  • return WinJS.xhr({ url: url1, headers: { "Cache-Control": "no-cache", "If-Modified-Since": "Mon, 27 Mar 1972 00:00 :00 GMT" } });
  • 将其添加为答案,以便将其设置为已解决并可能对其他人有所帮助

标签: javascript windows-store-apps winjs


【解决方案1】:

试试这个:

return WinJS.xhr({ url: myUrl, headers: { "Cache-Control": "no-cache"} });

【讨论】:

    猜你喜欢
    • 2012-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-27
    • 1970-01-01
    相关资源
    最近更新 更多