Monday, March 7, 2011

How do I launch a new browser window with no toolbars?

I want a hyperlink on my main page to launch an HTML help page in a new browser window. However I want the new window to only have an address bar, i.e. not have a menu, toolbars or status bar, and better still not even have an editable address bar.

I have seen this done on quite a few sites but can't figure out what I need to do to launch the new window in that state.

Any clues?

From stackoverflow
  • <SCRIPT LANGUAGE="javascript">
    <!--
    window.open ('titlepage.html', 'newwindow', config='height=100,
    width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,
    location=no, directories=no, status=no')
    -->
    </SCRIPT>
    
  • To expand a little on what ocdecio has above, you can place the window.open call a function accessed from your various hyperlinks, allowing different links to pop up new windows by passing in a different argument to the function.

    <a href="#" onclick="openWindow('faq.html');">FAQ</a>
    <a href="#" onclick="openWindow('options.html');">Options</a>
    
    <script language='Javascript'>
    <!--
      // Function to open new window containing window_src, 100x400
      function openWindow(window_src)
      {
        window.open(window_src, 'newwindow', config='height=100,width=400,
          toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, 
          directories=no, status=no');
      }
    -->
    </script>
    

0 comments:

Post a Comment