gpt4 book ai didi

javascript - window.location 在 Internet Explorer 中的 AJAX 请求后不起作用

转载 作者:数据小太阳 更新时间:2023-10-29 05:16:53 24 4
gpt4 key购买 nike

我正在尝试通过网页上的链接启动 ClickOnce 应用程序。该链接必须先转到服务器以请求事务 GUID,然后才能启动应用程序。代码是这样工作的:

function clickHandler() {
$.post('/gettransactionid.aspx', function(tranId) {
console.log("BEFORE");
window.location = "/deploy/Company.Domain.Product.application?" + tranId;
console.log("AFTER");
});
return false;
}

这在 Firefox 中工作得很好,但在 IE 中它执行导航并且不打开 clickonce 应用程序。之前和之后的 console.log 显示在 IE8 开发工具的控制台窗口中。任何帮助将不胜感激,因为我已经花了 4 个小时尝试用各种技巧解决它!

我试过:

  • 将 window.location 更改为 window.open。这只会启动一个窗口一秒钟,但无法启动应用程序。
  • 一个警报而不是 window.location。这没有任何作用。
  • 针对 IE7、IE8 和 IE9。
  • 通过将其添加到队列并在根窗口上下文中处理 window.location 来规避浏览器安全。
  • 我已经检查了 gettransactionid.aspx 返回的交易 ID。
  • 在 Firefox 中执行 - 效果很好。

在微软的文档中找到了答案:

If you have developed a custom Web page that launches a ClickOnce application using Active Scripting, you may find that the application will not launch on some machines. Internet Explorer contains a setting called Automatic prompting for file downloads, which affects this behavior. This setting is available on the Security Tab in its Options menu that affects this behavior. It is called Automatic prompting for file downloads, and it is listed underneath the Downloads category. The property is set to Enable by default for intranet Web pages, and to Disable by default for Internet Web pages. When this setting is set to Disable, any attempt to activate a ClickOnce application programmatically (for example, by assigning its URL to the document.location property) will be blocked. Under this circumstance, users can launch applications only through a user-initiated download, for example, by clicking a hyperlink set to the application's URL.

2011 年 9 月 1 日更新:具有讽刺意味的是,由于删除了“自动提示下载”,这在 IE9 中已经完全崩溃。

最佳答案

回答!

If you have developed a custom Web page that launches a ClickOnce application using Active Scripting, you may find that the application will not launch on some machines. Internet Explorer contains a setting called Automatic prompting for file downloads, which affects this behavior. This setting is available on the Security Tab in its Options menu that affects this behavior. It is called Automatic prompting for file downloads, and it is listed underneath the Downloads category. The property is set to Enable by default for intranet Web pages, and to Disable by default for Internet Web pages. When this setting is set to Disable, any attempt to activate a ClickOnce application programmatically (for example, by assigning its URL to the document.location property) will be blocked. Under this circumstance, users can launch applications only through a user-initiated download, for example, by clicking a hyperlink set to the application's URL.

因此更改 IE 安全设​​置以打开文件下载的自动提示。

关于javascript - window.location 在 Internet Explorer 中的 AJAX 请求后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5299076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com