jquery - FireFox Pop Up Blocker breaks javascript app when using .focus() -


i'm having problem firefox popup blocker , javascript code. since firefox blocks popup, statement .focus() throws error because window isn't open, scripts after not run due error. in other words, if firefox popup blocker blocks window opened in code, in turn breaks app, code after .focus() not work. console gives error win null

var win = window.open(url,window,options) win.focus() alert('hi'); 

i wasn't able find code check if window open before running .focus() code, have suggestions?

var win = window.open(url,window,options) if( win != null)     win.focus(); alert('hi'); 

this should work. have check if win defined. if not, dont call method on it.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -