Yogesh's Blog

Sharing me with blog…
Archive for July, 2010

Today i faced a problem in opening a new window through javascript’s window.open function. I provided new window url, window title and parameters like height, width etc. This was working fine in other browsers except IE. When window.open call was made, js error was coming and giving invalid argument attribute error. After some investigation, i found the reason was the title i was providing as second parameter in window.open call. Reason of error was space in provided title. So to fix the error, i modified title and replaced space to underscore. To do this, i applied this modification in code: Suppose title i was providing is stores in a javascript variable var title = “hello my dear friend”; var popupUrl = “http://www.yogeshsharma.in”; var otherAttb = “width=500, height=500”; window.open(popupUrl, title.replace(/ /g, ‘_’), otherAttb); Here title.replace(/ /g, ‘_’) replaces all the spaces from title to underscore, then no js comes in IE. 🙂