troubleshooting Question

window.open return null

Avatar of jamie_lynn
jamie_lynn asked on
JavaScript
5 Comments2 Solutions1824 ViewsLast Modified:
Hi,
I am trying to create a new window reference in Javascript to write to it later.

page1.html
var new_win = window.open("", "NewWin", 'scrollbars=yes,toolbar=no,width=100,height=100');
new_win.document.open();
new_win.document.write("test");

This works fine when I go to the page directly via http://server/page1.html.
However, if I redirect there using document.location = "page1.html", the window.open(..) returns null.
So I get a null pointer on line 2 at new_win.document.open().
This problem only occurs on IE, on mozilla or firefox, it works fine.

Is there a workaround for this in IE?

Thanks
Jamie
ASKER CERTIFIED SOLUTION
third

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros