Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Opening All External Links In "_blank" Page

  1. #11
    BawA's Avatar FST Pioneer BT Rep: +1
    Join Date
    Jun 2003
    Location
    Some Where but not here
    Age
    41
    Posts
    4,213
    Originally posted by 2nd gen noob+10 May 2004 - 13:41--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (2nd gen noob @ 10 May 2004 - 13:41)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin-bawa@Klite_user@10 May 2004 - 09:38
    setting one link a time is easy but if u have lots of links that u want them to open in new page will be hard to set them one by one so i want some kind of code or script that sets all&nbsp; external links to open in new page.
    Find and replace [/b][/quote]
    there is something wrong with " Search and Replace" function, here what i do:

    I open all my wanted documents and then search for a script under "all open documents" and i search and it finds all the scripts but when i click replace all i get "0 from 140 found", how could it be when it finds in search.


    "You can be mad as a mad dog at the way things went; you can swear and curse the fates, but when it comes to the end, you have to let go"
    Benjamen button

  2. Internet, Programming and Graphics   -   #12
    Naked Nudist
    Join Date
    Sep 2003
    Posts
    212
    Here is a Open All Offsite Links In New Window script from dynamicdrive. Edit it where it tells ya to and add it to the body section of your page.

    &#60;script language="JavaScript1.2">
    &#60;&#33;--

    //Open offsite links in new window option- By Jessica Hammer
    //Heavily modified by Dynamic Drive
    //Visit http://www.dynamicdrive.com for this script

    //1)Enter domains to be EXCLUDED from opening in new window:
    var excludedomains=["dynamicdrive.com", "javascriptkit.com"]

    //2)Automatically open offsite links in new window? (1=yes, 0 will render a checkbox for manual selection)
    var auto=1

    var excludedomains=excludedomains.join("|")
    rexcludedomains=new RegExp(excludedomains, "i")

    if (&#33;auto)
    document.write(&#39;<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>&#39

    function dynamiclink(){

    if (auto||(&#33;auto&&document.targetmain.targetnew.checked)){
    for (i=0; i<=(document.links.length-1); i++) {
    if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")&#33;=-1)
    document.links[i].target="_blank"
    }
    }
    else
    for (i=0; i<=(document.links.length-1); i++) {
    if (document.links[i].hostname.indexOf(mydomain)==-1)
    document.links[i].target=""
    }
    }

    if (auto)
    window.onload=dynamiclink

    // --&#62;
    </script>

  3. Internet, Programming and Graphics   -   #13
    BawA's Avatar FST Pioneer BT Rep: +1
    Join Date
    Jun 2003
    Location
    Some Where but not here
    Age
    41
    Posts
    4,213
    Finaly somebody understood wtf am talking about, thanks ma8


    "You can be mad as a mad dog at the way things went; you can swear and curse the fates, but when it comes to the end, you have to let go"
    Benjamen button

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

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