Need some JS code modification - HELP!

Discussion in 'HTML & Website Design' started by karan265, Jul 22, 2007.

  1. #1
    I'm not too experienced with JavaScript and I need this code modified.

    <script language="JavaScript" type="text/javascript">
    <!--
    function breakout_of_frame()
    {
      // see http://www.thesitewizard.com/archive/framebreak.shtml
      // for an explanation of this script and how to use it on your
      // own website
      if (top.location != location) {
        top.location.href = document.location.href ;
      }
    }
    -->
    </script>
    Code (markup):
    I want it in a way such that "if (top.location != location)" changes to "if (top.location != myurl.com)".

    I've spent quite some time trying to figure it out and attach variables to it etc., but it just doesn't work as I am still a n00b to JS.

    Can somebody help me? :D

    - Karan
     
    karan265, Jul 22, 2007 IP
  2. mgware

    mgware Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If I understood you, is this:

    
    <script language="JavaScript" type="text/javascript">
    <!--
    function breakout_of_frame()
    {
      // see http://www.thesitewizard.com/archive/framebreak.shtml
      // for an explanation of this script and how to use it on your
      // own website
      if (top.location != "myweb.com") {
        top.location.href = document.location.href ;
      }
    }
    -->
    </script>
    
    Code (markup):
     
    mgware, Jul 22, 2007 IP