By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,968 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,968 IT Pros & Developers. It's quick & easy.

Intranet Links

P: n/a

Hi,
I want to place a piece of JavaScript at the top of my page/s that wil
tell all links on that page to open in certain target windows dependin
on the hostname.

Suppose the intranet address is http://intranet
so this means that the hostname is "intranet" right?
If I want all intranet page links to open in the same window but al
other links (ie external internet links) to open in a new windo
(_blank) then would I use something like below? Please correct an
place I've gone wrong:

if(document.links.hostname == "intranet") {
this.target = "_top";
} return true;

But somewhere in there I would also need an "else" statement to tell i
to open all other links in "_blank" target. Can someone please tell m
where that should be added in. I'm fairly new to javascript and am no
exactly sure what order some of this stuff should go in.

Thank

HGJ
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message46077.htm

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"HGJS" <HG*********@mail.forum4designers.com> wrote in message
news:HG*********@mail.forum4designers.com...
<snip>
Posted via http://www.forum4designers.com


form4designers.com is a bad place to read comp.lang.javascript from
because their presentation of the group garbles the Usenet posts it is
derived from and they only report a fraction of the posts made to the
group, giving an incomplete representation.

forumj4designers.com is also a bad pace to ask javascript questions from
because their misrepresentation of the group, combined with deliberate
deceptions about the nature of the service that they provide, have
resulted in a level of resentment of forum4designers.com that will
negatively impact on anyone who decides to associate themselves with
that web site.

Many other sites provide superior web-based access to Usenet, and often
without distortion or omission, including groups.google.com (who also
provide extensive and flexible archive searching facilities). But the
best method of reading and posting to comp.lang.javascript is through a
news server via newsreader software.

Richard.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.