Solved

Check if a URL exist

Posted on 2000-03-01
5
716 Views
Last Modified: 2012-05-04
I have a JavaScript function with two different URLs. The first URL is the default URL and the JavaScript jumps to it, but if the first URL does not exist, the JavaScript must jump to the second one. I need a function that checks if the first URL exist and depending the result of this function, jump to the first or the second URL.
0
Comment
Question by:aikon
  • 3
  • 2
5 Comments
 

Accepted Solution

by:
Deathead earned 50 total points
ID: 2585024
Unfortunatly JS can't supply that information for you
0
 

Expert Comment

by:Deathead
ID: 2585034
Unfortunatly JS can't supply that information for you
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2601499
However if you can put an image on the 1st server, you can try this:

<IMG SRC="http://www.server1.com/testimage.gif"
onLoad="window.location='http://www.server1.com/'"
onError="window.location='http://www.server2.com/'">

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2601509
However if you can put an image on the 1st server, you can try this:

<IMG SRC="http://www.server1.com/testimage.gif"
onLoad="window.location='http://www.server1.com/'"
onError="window.location='http://www.server2.com/'">

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2601528
Sorry for the double posting - bad response time

Michel
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question