473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Detecting the Protocol of a Link


I'm making an Intranet site for someone who is not very familiar wit
making websites, thus I would like to make it as simple as possible fo
her when she needs to update it.

The intranet site uses frames - one menu frame that is always present
and one frame into which the content is loaded. The intranet sit
features many, many links to both internal and external pages - i
internal pages within the intranet and external pages on the interne
(http://)

What I would like to do is make it so that if a link is internal, th
content will load into the content frame and the menu frame will remai
at the side, but if the link is external, it will load the target int
the entire browser window. Using HTML, this would simply be a matter o
stating the href and then target="content_frame" for internal pages o
target="_top" for external pages.

But, like I said, I am making this site for someone who is not familia
with linking targets and even if I told her to define the targe
whenever she makes a link, she'd probably forget or get confused an
then wonder why external pages are loading with the intranet menu fram
still present or why intranet pages are loading with no menu at th
side!

While I have good experience with HTML, I am fairly new to JavaScript
which is why I am here asking for help.

I understand that Javascript can detect the protocol of a link,
believe you would use "link.protocol". In basic terms, what I woul
like to do is:

if link.protocol = "http://" then target="_top" els
target="content_frame"

But since I'm not familiar with the precise way of coding JavaScript,
would just like some help with transforming this into correc
JavaScript code so that it will work.

Thanks for taking the time to read this and for any help you can give

Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message44568.htm

Jul 20 '05 #1
1 3031


Unregistered wrote:
I'm making an Intranet site for someone who is not very familiar with
making websites, thus I would like to make it as simple as possible for
her when she needs to update it.

The intranet site uses frames - one menu frame that is always present,
and one frame into which the content is loaded. The intranet site
features many, many links to both internal and external pages - ie
internal pages within the intranet and external pages on the internet
(http://)
But doesn't the intranet use the HTTP protocol too? Or are you loading
pages locally via file: urls?

I understand that Javascript can detect the protocol of a link, I
believe you would use "link.protocol". In basic terms, what I would
like to do is:

if link.protocol = "http://" then target="_top" else
target="content_frame"

But since I'm not familiar with the precise way of coding JavaScript, I
would just like some help with transforming this into correct
JavaScript code so that it will work.


If your intranet pages are loaded from the file system then
<a onclick="if (this.protocol == 'http:') {
this.target = '_top';
}
return true;"
for your links will do
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jole | last post by:
Hi I'm writing a program that needs to read from a file. In order for the program to be robust, it should somehow check that the file isn't corrupt, or stuffed in any way. For example, that...
6
by: Charles Law | last post by:
This is going to seem like a basic OO question, but it comes up and bites me every now and again. Suppose we have a multi-tiered protocol to implement, what is the logical, OO way to design the...
3
by: pramod | last post by:
Two differenet applications (running on different OS, different compilers) are communicating thru protocol consisting of functions and arguments. Communication link can be TCP/IP, or serial port....
5
by: Fatih BOY | last post by:
Hi, How can i register my own protocol like app-help://somepage.html which searchs typed files under a predefined folder (like document folder under installation root) ? Fatih BOY
1
by: JB | last post by:
All, I am currently working on a project in which I need to detect whether or not NetBEUI is installed on a particular machine. From what I have seen I can find NETBUEI under...
1
by: rs | last post by:
how I the client tell the server that the socket is closed? or this there an even that informs the server that the clients socket is close? Oh, I am using vb.net 2003 Thanks
4
by: Alexander | last post by:
Hi, I am developing a web-application which will start telephone-calls using a special protocol (callto: or phone:) There will be two groups of users, one with a phone-client installed and...
25
by: Matt Kruse | last post by:
According to HTTP/1.1 specs, a client should only have two connections open to the host at a time (which can be changed by browser users, of course). When using xmlHttpRequest connections, is...
15
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.