www.webdeveloper.com
Results 1 to 7 of 7

Thread: Links

  1. #1
    Join Date
    Nov 2004
    Location
    Little Britain
    Posts
    352

    Links

    I have a page on my website which I want to have all the links in it open in a new window (which I have done) but have no address bar (and no status bar etc if possible, but am not that worried about that). Is there some code which I code insert in the head, without having to change each link?

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    This belongs in the JavaScript forum.

    Code:
    // Settings
    var d_winProps = 'width=400,height=400,menubar=no,statusbar=no,history=no';
    
    // No need to edit below this line
    onload = function(){
      if(document.links){
       var a = document.links;
        for(var i=0; i<a.length; i++){
         if(a[i].href.indexOf(location.host) == -1
         && a[i].href.indexOf("mailto")      == -1){
          a[i].onclick = function(){
            window.open(this.href,'child',d_winProps);
            return false;
           }
         }
        }
      }
     }

  3. #3
    Join Date
    Nov 2004
    Location
    Little Britain
    Posts
    352
    It didn't work so I put a script type in front of it, but it said Code corrupted. Insert fresh copy. Am I dong something wrong?

  4. #4
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Sorry, I did forget the SCRIPT tags, but the script should work nonetheless. I’ve never seen a browser report that code was corrupted and to insert a fresh copy. What browser are you using?

  5. #5
    Join Date
    Nov 2004
    Location
    Little Britain
    Posts
    352
    It didn't work in the preview section of HTML kit, nor in Internet Explorer (no surprises) 6.x

  6. #6
    Join Date
    Nov 2004
    Location
    Little Britain
    Posts
    352
    Don't worry, it works now for some reason. Thanks very much!

  7. #7
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Well, er, Iím glad it works for you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles