Activity Stream
48,167 MEMBERS
67420 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 7 of 7
  1.     
    #1
    Member

    Question PHP/Javascript: Make certain links open in a new window?

    Does anyone know a code for making a certain link open in a new window automatically?
    Example:
    All "besthostingforums.com" links will open in a new window
    I know I can do this manually but I probably have over 1000+ links in my blog that doesn't have a target="_blank" tag.
    Darlos Reviewed by Darlos on . PHP/Javascript: Make certain links open in a new window? Does anyone know a code for making a certain link open in a new window automatically? I know I can do this manually but I probably have over 1000+ links in my blog that doesn't have a target="_blank" tag. Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    You want to open each and every external link in a new tab?

  4.     
    #3
    Banned
    Website's:
    NitroXD.com
    use this code

    Code: 
    <a href='http://nitroxd.com/' target="_blank">NitroXD.com</a>

  5.     
    #4
    Banned
    Website's:
    NitroXD.com
    just change the title & link to your choice & add it to your website & click the link ,, then it will be opened in new tab

  6.     
    #5
    Member
    @NiKE,

    Sorry but I already know that code. I need one that will automatically add a code like that in for example, "KWWHunction" list of links.

    You want to open each and every external link in a new tab?
    Yep! but not me, my visitors.

  7.     
    #6
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    Ok! Try this code, this will make all links add target="_blank" on load of the page

    PHP Code: 
    <html>
    <
    head>
    <
    title>Add target _blank in all Links by Javascript</title>

    <
    script type="text/javascript">
    window.onload=addtargetblankinalllinks // add the function on load of the page
    function addtargetblankinalllinks() {
    var 
    links document.getElementsByTagName('a');
    for(
    i in links)
        
    links[i].target="_blank";
    }
    </script>

    </head>
    <body>
    <a href="http://www.dl4everything.com">DL4EVERYTHING</a><br />
    <a href="http://www.soft2050.in">Soft2050</a><br />
    <a href="http://www.google.com">Google</a><br />
    <a href="http://www.yahoo.com">Yahoo</a><br />
    <a href="http://www.facebook.com">Facebook</a><br />
    All Links will open in new tab even the links don't have any target _blank
    </body>
    </html> 
    Eg Link for testing: http://pastehtml.com/view/bmbwg4vvx.html

  8.     
    #7
    Member
    Thanks, @soft2050

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 6th Jul 2012, 10:11 PM
  2. Open multiple links at once
    By Daniel in forum Webmaster Resources
    Replies: 0
    Last Post: 2nd Nov 2011, 09:04 AM
  3. Open All Links in new tab?
    By RNBxBeatz in forum Web Development Area
    Replies: 3
    Last Post: 11th Jun 2011, 11:10 AM
  4. [Selling] Links and buttons spots open again.
    By MrPeanut420 in forum Completed Transactions
    Replies: 13
    Last Post: 10th Jul 2010, 07:25 AM
  5. Links open in same page??
    By AngieBaby in forum phpBB
    Replies: 13
    Last Post: 14th Feb 2010, 04:07 PM

Tags for this Thread

BE SOCIAL