Do you know you should not open popup windows and use a javascript modal instead?
  v1.0 Posted at 18/11/2016 3:18 AM by Tiago Araujo

The popup blockers in several browsers prevent JavaScript from being used to open windows without user interaction (e.g. clicking a link). You should use an anchor tag instead.

​<body onload="window.open('http://www.mydomain.com/document.html');return true;">

Figure: Bad Example - using JavaScrip in OnLoad event​

​<a href="http://www.mydomain.com/document.html" target="_new">Document</a>

Figure: Good Example - Using HTML anchor tag. This will open in a new tab or window depending upon browser configuration​​

<a href="#" onclick="window.open('http://www.mydomain.com/document.html');return false;">Document</a>

Figure: Good Example - Using Javascript in an onclick event means you can force a popup window in preference to a new tab and also control the size and placement of the window

We have a program called SSW Code Auditor to check for this rule.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: