Jump to content

What's A Good Way To Stall Javascript


dickey38
 Share

Recommended Posts

I have javascript containing:auxwndw = window.open('mypage');auxwndw.focus();I got an error in IE 'auxwndw is null or not an object'.I assume the 2nd line of code executed before the first line had completed the window-open operation.What's a good way to "stall" the script to avoid this?Thanks.

Link to comment
Share on other sites

window.open should be synchronous, so it should wait for that to return before it moves on to the next line. Does this restriction apply to you:

Internet Explorer 7 on Windows Vista: Opening a new window from an application (other than the Internet Explorer process) may result in a null return value. This restriction occurs because Internet Explorer runs in protected mode by default. One facet of protected mode prevents applications from having priveledged access to Internet Explorer when that access spans process boundaries. Opening a new window by using this method generates a new process. For more information about protected mode, see Understanding and Working in Protected Mode Internet Explorer. This commonly occurs for applications that host the WebBrowser control.
Link to comment
Share on other sites

window.open should be synchronous, so it should wait for that to return before it moves on to the next line. Does this restriction apply to you:
Thanks for info, but I don't think this applies. The js code is running from an html page rendered from a .aspx page, and I've taken care to keep postbacks from happening.Anyway, I guess the focus() statement is redundant so I've taken it out.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...