leZut

http://fred.dsimprove.org/sourcecode

This script needs to be displayed within a frame or an iframe (which it might not be right now). Otherwise parent.location gives the exact same result as window.loaction would, which in this case would be nothing, the requested location (url) being an empty hash.

When called in a (i)frame, this page will 'jump out' of its frame to fill the whole window on a simple mouse click. Or a double-click, if you replace onClick with onDblClick.

I've only tested it with iframes, though. Just assuming it would work the same in frames.

It can be useful for banners, for example: The banner consist only in a (topleft?) fraction of the page, but the page is already fully loaded (don't forget overflow: hide; as a style property of the iframe, along with width and height - not indispensable but safer). So when a visitor clicks on the banner, the banner/page comes to fill the whole window without needing to load. That means banners reacting hyper-quickly.

It should also be useful to force getting out of the stinky frames Hotmail (to mention just one) opens mailed links in. But then onLoad could be prefered to onClick.

Instead of that empty hash, you can use anchors (<a name="anchorName"></a> and then leZut('anchorName')) to jump to a specific spot in your page. Also, you can put the on[Dbl]Click event not inside the body tag, but inside another object's tag, creating a "button" effect... Be creative !


<head>
  <style type="text/css">
  <!--
    p       {width: 80%;}
    a       {text-decoration: none;}
    a:hover {text-decoration: underline;}
  -->
  </style>
  <script language="javascript">
  <!--
    var leZut_done = false;
    function leZut(anchor) {
      if (!leZut_done) {
        parent.location = '#'+anchor ;
        leZut_done = true;
        }
      }
  -->
  </script>
</head>
<body onLoad="window.focus();"
      onClick="leZut('');"
      >
  <h2>leZut</h2>
  <a href="http://fred.dsimprove.org/sourcecode"
     target="winFredSource">http://fred.dsimprove.org/sourcecode</a>
  <p>This script needs to be displayed within a frame or an iframe 
     (which it might not be right now). 
     Otherwise <i>parent.location</i> gives the exact same result as 
     <i>window.loaction</i> would, which in this case would be nothing, 
     the requested location (url) being an empty hash.</p>
  <p>When called in a (i)frame, this page will 'jump out' of its frame 
     to fill the whole window on a simple mouse click. 
     Or a double-click, if you replace <i>onClick</i> with 
     <i>onDblClick</i>.</p>
  <p>I've only tested it with iframes, though. 
     Just assuming it would work the same in frames.</p>
  <p>Instead of that empty hash, you can use anchors 
     (<i><a name="anchorName"></a></i> 
     and then <i>leZut('anchorName')</i>) 
     to jump to a specific spot in your page.
     Also, you can put the <i>on[Dbl]Click</i> event 
     not inside the <i>body</i> tag, but inside another
     object's tag, creating a "button" effect... Be creative !</p>
</body>