If you are seeing this message, it is possible the page did not load properly. Please hit reload/refresh on your browser.
If you still see this message, you probably do not have a browser that supports web standards, although its content is accessible to any browser or Internet device.

Cool Tips & Tricks Cool Tips & Tricks

Help Communities:
Help Forums Bug Base
<< Prev Topic | Next Topic >>
Cool Tips & Tricks ::: Javascript FAQ ::: Redirect offsite links to open in a new window
New Topic    Add Reply
Topic: Redirect offsite links to open in a new window  (?)  Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend
Nutrocker

ezboard Moderator
ezSupporter
Posts: 15891
Posted: 6/16/05 2:10 pm    
Redirect offsite links to open in a new window
A re-jig of a script to fix the problem with Bulk Commands for admin and mods. Can use this and still use the Check All / Clear All links within forums, and any other links with javascript in their href.

Place this script in your custom <head>, 1st box in custom HTML.
 
<script type="text/javascript">
function redirect()
{
  for (k = 0; k < document.links.length; k++) {
    if (document.links[k].href.toLowerCase().indexOf("javascript") == -1) {
      if (document.links[k].hostname != self.location.hostname) {
        document.links[k].target = "_blank"
        } else { 
        document.links[k].target = "_self"
      }
    }
  }
}
window.onload = redirect;
</script>


Author :: chrish18


  reply to this message

Nutrocker

ezboard Moderator
ezSupporter
Posts: 16620
Posted: 12/2/05 3:47 pm    
Re: Redirect offsite links to open in a new window
If you discover that some links may not get redirected with the above script, it may be that the page has not fully loaded and therefor the script has not quite kicked in yet, so use this script instead...

  
<script type="text/javascript">
function redirect()
{
  for (k = 0; k < document.links.length; k++) {
    if (document.links[k].href.toLowerCase().indexOf("javascript") == -1) {
      if (document.links[k].hostname != self.location.hostname) {
        document.links[k].target = "_blank"
        } else { 
        document.links[k].target = "_self"
      }
    }
  }
}

redirect();
</script>


  reply to this message

Click to receive email notification of replies Click to stop receiving email notification of replies email this topic to a friend

New Topic    Add Reply

jump to:
Topic Control Image::: Topic Commands
<< Prev Topic | Next Topic >>

Icon Legend

reply button:::Reply to Post Button   edit button:::Edit Post Button  delete button:::Delete Post Button (Moderator Only)

subscribe/unsubscribe to thread button:::Subscribe to Thread Button   email to friend button:::Email to Friend Button  



- Cool Tips & Tricks - Javascript FAQ -

Communitiesezboard Help Communities:

Help Forums Help Forums Bug Base Bug Base





Powered By ezboard® Ver. 7.32
Copyright ©1999-2007 ezboard, Inc.