Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31077

Re: Open all links in new window

Newsgroups comp.lang.javascript
Date 2016-08-05 09:44 -0700
References (4 earlier) <87wpjwsj4w.fsf@bsb.me.uk> <56528385-a0f0-4b95-b138-830a6ad9beec@googlegroups.com> <87k2fvr1er.fsf@bsb.me.uk> <dcdbdbe6-80b7-48e1-a4d9-994adafede02@googlegroups.com> <878twbqpem.fsf@bsb.me.uk>
Message-ID <beb7a7da-49ff-48a5-88ac-64af5afcaaf6@googlegroups.com> (permalink)
Subject Re: Open all links in new window
From Chandra <csakkoni@gmail.com>

Show all headers | View raw


On Friday, August 5, 2016 at 7:38:40 PM UTC+5:30, Ben Bacarisse wrote:
> Chandramohan Akkoni <csakkoni@gmail.com> writes:
> 
> > On Friday, August 5, 2016 at 3:19:24 PM UTC+5:30, Ben Bacarisse wrote:
> >> Chandramohan Akkoni <csakkoni@gmail.com> writes:
> >> <snip>
> >> > Currently I have the below code which makes the external web page
> >> > links open in a new window.
> >> >
> >> > if (thelink.indexOf("http://www.google.co.in/" ||
> >> > "http://www.facebook.com/") !== 0){
> >> >      linkarray.target = "_blank"; 
> >> >      }
> >> 
> >> Is that really what you have?  Do you know what it does?
> >> 
> >> > All the internal micro-sites are also opening on a new tab, which
> >> > should happen. Example:
> >> > http://books.google.co.in/
> >> > http://developers.facebook.com/
> >> 
> >> Did you miss out a "not"?
> >> 
> >> <snip>
> >> -- 
> >> Ben.
> 
> It's better to snip signatures.
> 
> > No no Ben, I have shared the dummy urls as examples. My need is to
> > load the micro-sites in the same window. As with the current code,
> > they are opening on a new tab.
> 
> Why don't you answer questions?  You seem to expect help without helping
> us help you.  Do you know what the code you quoted does?  I ask because,
> as written, it is certainly wrong.
> 
> Another problem is that you are not showing us the code that does what
> you say.  Something is setting target = "_blank" for the sites you don't
> want opened in a new window/tab.  It may be that the best solution is to
> fix that code rather than to add more.
> 
> <snip>
> -- 
> Ben.

I'm using the below code to load 3rd party urls in a new tab.

function uu() { 
   var alllinks = document.links.length; 
   var linkarray; 
   var thelink; 

   while (alllinks--) { 
   linkarray = document.links[alllinks]; 
   thelink = linkarray.href; 

     if (thelink.indexOf("http://www.google.co.in/") !== 0) { 
     linkarray.target = "_blank"; 
     } 
   } 
} 
window.onload = uu; 

Now, I want the sub-domains (micro-sites) also open in a new window. Like "http://books.google.co.in/", "https://groups.google.com/".

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Open all links in new window csakkoni@gmail.com - 2016-07-27 01:44 -0700
  Re: Open all links in new window JJ <jj4public@vfemail.net> - 2016-07-27 17:40 +0700
  Re: Open all links in new window Flng Fck <nothanks@invalid.invalid> - 2016-07-27 15:21 +0200
    Re: Open all links in new window csakkoni@gmail.com - 2016-07-27 23:33 -0700
      Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-07-28 11:02 +0200
        Re: Open all links in new window wmgill <webworker1950@gmail.com> - 2016-08-14 14:23 -0400
          Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-14 23:31 +0200
            Re: Open all links in new window wmgill <webworker1950@gmail.com> - 2016-08-14 17:43 -0400
              Re: Open all links in new window Robert Baer <robertbaer@localnet.com> - 2016-08-18 16:11 -0800
                Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-19 11:52 +0200
                Re: Open all links in new window wmgill <webworker1950@gmail.com> - 2016-08-20 01:08 -0400
                Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-20 09:15 +0200
                Re: Open all links in new window wmgill <webworker1950@gmail.com> - 2016-08-20 12:09 -0400
                Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-20 21:50 +0200
                Re: Open all links in new window $Bill <news@todbe.com> - 2016-08-20 17:21 -0700
                Re: Open all links in new window "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-20 19:48 -0700
                Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-21 09:42 +0200
                Re: Open all links in new window Andrew Poulos <ap_prog@hotmail.com> - 2016-08-21 19:29 +1000
                Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-22 00:44 +0200
                Re: Open all links in new window Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-08-22 21:58 +0100
                Re: Open all links in new window $Bill <news@todbe.com> - 2016-08-22 21:52 -0700
                Re: Open all links in new window "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-23 12:23 +0200
          Re: Open all links in new window Scott Sauyet <scott@sauyet.com> - 2016-09-03 19:55 +0000
  Re: Open all links in new window Chandramohan Akkoni <csakkoni@gmail.com> - 2016-08-03 22:28 -0700
    Re: Open all links in new window Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-04 11:05 +0100
      Re: Open all links in new window Chandramohan Akkoni <csakkoni@gmail.com> - 2016-08-04 03:46 -0700
        Re: Open all links in new window Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-04 15:28 +0100
          Re: Open all links in new window Chandramohan Akkoni <csakkoni@gmail.com> - 2016-08-05 01:34 -0700
            Re: Open all links in new window Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-05 10:49 +0100
              Re: Open all links in new window Chandramohan Akkoni <csakkoni@gmail.com> - 2016-08-05 02:56 -0700
                Re: Open all links in new window Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-05 15:08 +0100
                Re: Open all links in new window Chandra <csakkoni@gmail.com> - 2016-08-05 09:44 -0700
                Re: Open all links in new window Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-05 21:26 +0100

csiph-web