IE 历史记录跟踪、IFRAMES 和跨域错误

发布于 2024-09-04 03:31:49 字数 828 浏览 14 评论 0原文

所以这就是交易。我们有一个在 HTML 文件中运行的 Flash 应用程序。对于一个页面,我们将 ASP.NET 中的旧报告系统称为 IFRAME 内的系统。然后,该页面使用跨域脚本与 Flash 应用程序进行通信(在两个页面中都设置了 document.domain = "domain"。

这一切都有效。

现在最关键的是。Flash 启用了历史记录跟踪。这将加载历史记录.js 文件,该文件创建了一个 div 标签来存储页面更改,以便后退和前进按钮在浏览器中工作,

因为它们创建了 div 标签,

在 Internet Explorer 中,history.js 创建了另一个 IFRAME 。 (而不是 DIV)称为 ie_historyFrame 当 ScriptResource.axd 代码尝试访问此内容时:

var frameDoc = this._historyFrame.contentWindow.document;

我们收到“访问被拒绝”错误消息!

  • 我们已尝试获取此 IFRAME 的句柄并插入 document.domain。代码失败。
  • 编辑历史模板文件,flex 也使用该文件来包含 document.domain...失败。
  • 我们尝试 禁用历史记录的 ASP.NET 页面 在 ScriptManager 中跟踪 控制。失败。

在这件事上我已经无计可施了。我们有用户需要使用IE来访问该网站。他们是大客户,我们不能告诉他们只使用 Firefox。

如有任何建议,我们将不胜感激。

So here's the deal. We have a Flash application that is running within an HTML file. For one page we call a legacy reporting system in ASP.NET that is within an IFRAME. This page then communicates back to the Flash application using cross-domain scripting (document.domain = "domain" is set in both pages.

THIS ALL WORKS.

Now the kicker. Flash has history tracking enabled. This loads the history.js file that created a div tag to store page changes so the back and forward buttons work in the browser.

Which works for Firefox and Chrome as they create a div tag.

HOWEVER

In Internet Explorer, history.js creates another IFRAME (instead of a DIV) called ie_historyFrame. When the ScriptResource.axd code attempts to access this with:

var frameDoc = this._historyFrame.contentWindow.document;

we get an "Access is Denied" error message. ARGH!

  • We've tried getting a handle to this IFRAME and inserting the document.domain code. FAIL.
  • We've tried editing the historytemplate.html file that flex also uses to include document.domain... FAIL.
  • I've tried to edit the underlying
    ASP.NET page to disable history
    tracking in the ScriptManager
    control. FAIL.

At my wit's end on this one. We have users who need to use IE to access this site. They are big clients who we cannot tell to just use Firefox.

Any suggestions would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吃兔兔 2024-09-11 03:31:49

我知道这是最后的选择,但您应该考虑考虑 IE 可能无法支持。您需要客观的证据、一些可以清楚地显示问题的示例,以及经过充分排练的关于保持符合标准而不是专门针对(可能过时的)版本的 IE 进行编码的好处的演讲。

这永远无法保证,但如果你能让他们相信存在客观的好处,可以降低短期和长期成本,那么就值得尝试——只需记住,对于许多客户来说,他们关心的是业务案例,而不是技术案例。

I understand it's a last-ditch scenario, but you should consider making the case that IE may not be possible to support. You'll need objective evidence, some samples that clearly show the problem, and a well-rehearsed spiel about the benefits of remaining standards-complient instead of coding specifically to a (probably dated) version of IE.

It's never guaranteed, but if you can convince them that there are objective benefits which will lower both the short and long-term costs then it's worth trying--just remember that for many clients are concerned with the business-case and not the techinical case.

ゞ花落谁相伴 2024-09-11 03:31:49

不确定,但从服务器发送此标头可能会起作用:

// in PHP...
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"',true);

我已使用它在 iframe 中通过 JS 代码设置 cookie。

Not sure but sending this header from the server might work:

// in PHP...
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"',true);

I've used it for setting cookies from JS code in an iframe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文