Annoying IE7 bug with window.opener.document.location

I have just wasted an hour of my day trying to figure this out. It works in Mozilla as expected and I havent tried IE6 but IE7 threw a strange error.

2007-01-25 14:10:00.0

Annoying IE7 bug with window.opener.document.location

I hate these types of bugs.

I have just wasted an hour of my day trying to figure this out. It works in Mozilla as expected and I havent tried IE6 but IE7 threw a strange error.

I was trying to check if a certain string was in the url of the window that opened a pop-up.

The code I was using that failed was:

I tried everything I could think of to try and test and re-check my code etc. I stripped it all back and thought maybe it was to do with string types so did the following:

Bingo...it worked. Turns out when I concatenate the str variable with an empty string, it solved the problem.

BTW, the code above is taken from the updates I am making to CF_FileManager to allow it to use CF_ProFlashUpload if you have that component in your dcCom folder.

Working pretty well right now!

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [5] - Leave a comment

Comments

rich said:
"location" is actually an object, not a string....you probably want to use window.opener.document.location.search.

http://developer.mozilla.org/en/docs/DOM:window.location#Properties

You could also do location.toString(), which is what you have effectively done by concatenating an empty string on the end.

Good luck....

rich
Dan said:
Thats interesting and I was thinking along that line. What threw me was the fact that alerting the value didnt give the usual "object". I am guessing alert casts the object to a string?
jewellry said:
I had that same problem myself and but actually solved it by first following the method that Rich suggested going with the window.opener.document.location.search. It was a lot less time consuming than doing what you've done here, although your way has obviously worked for you. I would never have thought to add an empty string to the line and see if that helped because usually it only causes disaster, especially with IE7. I may convert back to IE6 just because it's easier to use in regards to well...everything, even FTP uploading. How did you come up with the idea to add the empty string? I'm sure a few people out there will definitely want to know why you used that particular method when it's usually not the best way to solve a problem. Also, exactly what were you trying to upload at the time that caused the problem and to where? I've found that only certain document types find themselves experiencing this type of error.
Thanks for sharing this to us. I?ve completely rejected the idea of using IE7 months ago because of some unidentified bugs. With this in mind, probably I?ll go back to IE this time.
Famous Love Quotes said:
Great work on tracking it down. Very popular problem and another to add to the list. thanks to IE7 yet agian...!