Question

Window.open javascript function is not working in Mozilla, but working in other browsers, here is what I have write.

<a href="javascript:window.open('../Terms.aspx','Terms','width=550,height=400')">
                click here</a>

Actually what happened in Mozilla is popup is opened but parent window is blank with [object Window]

Please tell me What I am doing wrong?

Thanks

Was it helpful?

Solution

The script looks all right, what might be a problem is that you are running it in the URL. Use the click event instead.

Also, you can use the href and target attributes in the link to make it degrade gracefully. That way the link will at least open up the page even if Javascript is disabled in the browser:

<a href="../Terms.aspx" target="Terms" onclick="window.open(this.href,this.target,'width=550,height=400');return false;">
  click here</a>

OTHER TIPS

Try a generator.

Alternatively, you might want to try href="javascript: randomVar = window.open ...". The issue might be that the window.open function returns an ID, thus breaking the in-line JavaScript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top