Forum Moderators: open

Message Too Old, No Replies

ie6 window.name strangeness ( unspecifiedFrame)

         

mikewse

5:02 pm on Jan 10, 2007 (gmt 0)

10+ Year Member



I'm having a strange problem with window.name (from JavaScript) on *some* of our computers. OS is Windows 2000 so Internet Explorer version is IE6 sp1. I really need some help here...

We are using window.name to set a hidden value in the browser that persists between page navs on our site. So the first page will set this value, giving the window a name, and this value can be used by the following pages when navigated to. Scenario:

page1: 
set window.name = "123";
<user clicks a link to page2>
page2:
window.name still has value "123"

BUT, on some computers the name is replaced with "_unspecifiedFrame":

page1: 
set window.name = "123";
<user clicks a link to page2>
page2:
window.name is "_unspecifiedFrame" (!)

Worth noting is that the window name is "_unspecifiedFrame", and not just the empty string "" that seems to be the default otherwise.

Does anybody know what is going on, and how to avoid "_unspecifiedFrame"?

//Mike

mikewse

12:27 pm on Jan 11, 2007 (gmt 0)

10+ Year Member



I now know more about the cause of the problem and it is not related to which machine I run on. Instead, it is related to how the browser window is opened:

If the browser window was initially opened without (or with an empty) window.name, then it will allow its name to be changed and persist the new value.

But if the window was opened with a name, f ex with window.open(url, "myName"), then the supplied "myName" will persist throughout the window's lifetime and cannot be changed. Actually, it will seem like you can change the window.name if you do

window.name="abc" 
alert(window.name)

but the old value will be restored immediately after. FireFox always let you change the window.name.

So, I guess the workaround I need to do is to pop a new window (with empty window.name) when I hit these cases.

To wrap up, I should also mention that the reason we were seeing window.name=="_unspecifiedFrame" was because the user had opened the link from an Outlook email message and Outlook supplies the "_unspecifiedFrame" target name.