<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>

<nde:article 
  url="/viewsource/2002/popup-control/"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:nde="http://devedge.netscape.com/2002/de"
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en"
  >

  <nde:header>
  <nde:title>
    Popup Window Controls and Your Website
  </nde:title>

  <nde:category>
    TechNote
  </nde:category>

  <nde:authlist>
    <nde:author>
      <nde:authname>
        Bob Clary
      </nde:authname>
      <nde:authaffil>
        Netscape Communications
      </nde:authaffil>
    </nde:author>
  </nde:authlist>

  <nde:pubdate year="2002" month="12" day="05"/>

  <nde:channels>
    <nde:channel id="viewsource"/>
    <nde:channel id="ns-7"/>
  </nde:channels>
  <nde:summary>
      Netscape 7.01 allows users to control most unsolicited attempts
      to open new windows such as popup and popunder windows.  
      Learn how to detect Popup Controls, how to ask your readers to 
      enable popups for your site and how to get the benefits of 
      popup windows without using popup windows.
  </nde:summary>
  <nde:abstract>
    <p>
      Netscape 7.01 allows users to control most unsolicited attempts
      to open new windows such as popup and popunder windows.  
      Learn how to detect Popup Controls, how to ask your readers to 
      enable popups for your site and how to get the benefits of 
      popup windows without using popup windows.
    </p>
  </nde:abstract>
  <nde:keywords>solutionfinder, popup, popup windows, blocking, blocking popup windows</nde:keywords>

</nde:header>

  <!-- optional markup to be included in HEAD of HTML document -->
  <nde:head>
  </nde:head>

  <!-- required article content -->
  <nde:content>
    <h2>Popup Window Controls Configuration in Netscape 7.01</h2>

    <p>
      Using the Preference for Privacy &amp; Security - Popup Controls, Netscape 7.01 users 
      can:
    </p>

    <ul>
      <li>
	  allow all sites to open Popup windows except for sites which
	  the user has explicity denied permission
      </li>
      <li>
	suppress all sites from opening Popup windows except for sites which the
	  user has explicitly granted permission.
      </li>
    </ul>

    <h2>What Popup Windows are suppressed ?</h2>

    <p>
      Netscape 7.01 will attempt to suppress all calls to <code>window.open()</code>
      which occur in the following circumstances:
    </p>

    <ul>
      <li>global script which is executed as the document is loading</li>
      <li>script executed as part of a <code>onload</code> event handler</li>
      <li>script executed in <code>setTimeout()</code> or <code>setInterval()</code></li>
    </ul>

    <h2>What Popup Windows are not suppressed?</h2>

    <p>
      Any attempt to open a popup window that is the direct result of 
      user action, such as clicking on a hyperlink, should succeed in opening
      popup windows even if the user has popup controls enabled on your site.
    </p>

    <h2>Detecting Suppressed Popups Windows</h2>

    <p>
      If a user has popup controls enabled for your site, any attempt to call 
      <code>window.open</code> in global script, in an <code>onload</code> handler or 
      in <code>setTimeout()</code> or <code>setInterval()</code> will return <code>null</code>
      rather than a reference to the opened window.
    </p>

    <pre><![CDATA[
      <html>
	<head>
	  <title>Detecting Popup Controls</title>
	  <script type="text/javascript">
          <!--
	  // attempt to open an unsolicited window
	  var popup = window.open('about:blank', 'popup');
	  if (!popup)
	  {
	    // the user has suppressed the popup
	  }
	  // -->
	  </script>
	</head>
	<body>
	  // your page here
	</body>
      </html>
      ]]></pre>

    <p>
      If your popup window is crucial to the operation of your web site 
      you can notify the user and ask them to add your site to the list 
      of sites which are allowed to use unsolicited popup windows. You can 
      also provide a hyperlink which can be used to open a popup window
      even in the event that the user has suppressed unsolicited popups on your site.
    </p>

    <h2>Replacements for Popup Windows</h2>

    <p>
      If your popup was created during the time the web page was loading,
      you may consider using <code>document.write()</code> to emit appropriate
      HTML which will contain the same information as the popup window. You can
      also use either the advanced features in the Document Object Model (DOM)
      or <code>innerHTML</code> to create the appropriate HTML.
    </p>

    <h3>Example</h3>

    <p>
      This <a href="example.html" target="_new">example</a> 
      (<a href="example.html.txt" target="_new">view example source</a>) 
      illustrates detecting suppressed popup windows as well as an approach for 
      replacing popup windows with inline HTML using <code>innerHTML</code>. 
    </p>

  </nde:content>

<nde:related area="nde">
  <nde:item url="/library/releases/netscape-7/">Other Articles about Netscape 7</nde:item>
</nde:related>

</nde:article>
