简体   繁体   中英

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

Updating a legacy site in ASP that uses frames/framesets. We can only use this site using IE or Edge which is fine, but we have to set emulation/compatibility mode to 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:

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+

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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