简体   繁体   English

parent.window.frames("framename").navigate(url); 在 IE Edge 中给出函数预期错误

[英]parent.window.frames("framename").navigate(url); gives Function expected error in IE Edge

Updating a legacy site in ASP that uses frames/framesets.在 ASP 中更新使用框架/框架集的旧站点。 We can only use this site using IE or Edge which is fine, but we have to set emulation/compatibility mode to IE 5.我们只能使用 IE 或 Edge 使用此站点,这很好,但我们必须将仿真/兼容模式设置为 IE 5。

The issue I am getting:我得到的问题:

 parent.window.frames("framename").navigate(url);

Kicks an error in the IE debugger when using anything other than IE5 mode:使用 IE5 模式以外的任何其他模式时,在 IE 调试器中引发错误:

Function expected

Is there a new way to accomplish the same thing?有没有新的方法来完成同样的事情? Someone suggested using:有人建议使用:

 parent.window.frames("framename").location.href(url);

But didn't work.但是没有用。 Any ideas?有任何想法吗?

Sometimes I answer my own question faster than the crowd :)有时我比人群更快地回答我自己的问题:)

This works with IE 9+这适用于 IE 9+

parent.window.frames["framename"].navigate(url);

But to coexist so my IE 5 emulated users can still use the site I had to wrap it in a condition:但是为了共存所以我的 IE 5 模拟用户仍然可以使用我必须将它包装在一个条件下的站点:

if (Function('/*@cc_on return document.documentMode>8@*/')()) {
    parent.window.frames["framename"].navigate(url);
} else {
    parent.window.frames("framename").navigate(url);
}

This checks the browser/emulation level and uses the appropriate syntax.这会检查浏览器/仿真级别并使用适当的语法。 This is working for me.这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM