473,804 Members | 3,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking if URL exists

Is there a way in JavaScript to test if a webpage exists, for example
before redirecting a browser window to that page?

What I am trying to do is customize an acknowledgement page for
particular users depending upon choices they make when completing a
form.
Jul 14 '07 #1
5 4869
On Jul 14, 9:48 am, Gargoyle <nob...@loadsar ubbish.perswrot e:
Is there a way in JavaScript to test if a webpage exists, for example
before redirecting a browser window to that page?
You can try to load it with AJAX.
What I am trying to do is customize an acknowledgement page for
particular users depending upon choices they make when completing a
form.
I don't understand what this has to do with the question.

Jul 14 '07 #2
On Sat, 14 Jul 2007 07:11:09 -0700, David Mark
<dm***********@ gmail.comwrote:
>On Jul 14, 9:48 am, Gargoyle <nob...@loadsar ubbish.perswrot e:
>Is there a way in JavaScript to test if a webpage exists, for example
before redirecting a browser window to that page?

You can try to load it with AJAX.
>What I am trying to do is customize an acknowledgement page for
particular users depending upon choices they make when completing a
form.

I don't understand what this has to do with the question.
Basically, I wanted to test if the customized page existed before
redirecting the user to that page.
Jul 14 '07 #3
On Jul 14, 10:13 am, Gargoyle <nob...@loadsar ubbish.perswrot e:
On Sat, 14 Jul 2007 07:11:09 -0700, David Mark

<dmark.cins...@ gmail.comwrote:
On Jul 14, 9:48 am, Gargoyle <nob...@loadsar ubbish.perswrot e:
Is there a way in JavaScript to test if a webpage exists, for example
before redirecting a browser window to that page?
You can try to load it with AJAX.
What I am trying to do is customize an acknowledgement page for
particular users depending upon choices they make when completing a
form.
I don't understand what this has to do with the question.

Basically, I wanted to test if the customized page existed before
redirecting the user to that page.
Why wouldn't it exist? Is it maintained by somebody else?

Jul 14 '07 #4
On Sat, 14 Jul 2007 07:22:14 -0700, David Mark
<dm***********@ gmail.comwrote:
>
Why wouldn't it exist? Is it maintained by somebody else?
It should exist, but just in case the page/file had been deleted (for
an old customer) I wanted to be sure.
Jul 14 '07 #5
Gargoyle wrote on 14 jul 2007 in comp.lang.javas cript:
On Sat, 14 Jul 2007 07:22:14 -0700, David Mark
<dm***********@ gmail.comwrote:
>>
Why wouldn't it exist? Is it maintained by somebody else?

It should exist, but just in case the page/file had been deleted (for
an old customer) I wanted to be sure.
If you have access to serverside scripting,
make a dedicated 404.asp [or the php equivalent] file
that reports to you where a file does not exist
and the referrer page is from your own domain.

That some browsers do not give a correct referrer,
is not that important, you'll just miss a few.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 14 '07 #6

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

Similar topics

9
2665
by: Bart Nessux | last post by:
Are these equivelent? Is one approach prefered over the other #check to see if var contains something... if so proceed. if var is not None: continue #check to see if var is empty... if so prompt user again.
3
1757
by: Phil Lamey | last post by:
Hi Folks, I have run into a bit of an issue with checking for files. Some files reside on Server X and some on Server Y. The page with all the links is on Server X. If the file exists we display a link, if it does not then we display "sorry not yet available". For the files on server X it is no problem I use an FSO and don't have a problem. For files on server Y I am having a big problem.
5
19539
by: Richard L Rosenheim | last post by:
What's the proper technique for checking for the existence of an attribute within a node? Lets say I did a SelectSingleNode which returned this element: <AnAddress city="San Francisco" state="CA" /> What's the best why of determining if the attribute zipcode exists in this node? If I try accessing the attribute with code like: ZipCode = myNode.Attributes("zipcode").Value
5
23085
by: BerkshireGuy | last post by:
Hello everyone, I have a bond form that a user uses to enter data. One of my fields, is PolicyNumber. I added some code on the Before Update event of txtPolicyNumber that checks to see if that policy number is in the system when entering a new record. If it is, I want it to display a message and go back to the policy number field. I've tried this code on a policy number that is not in the table and it
15
114216
by: Geiregat Jonas | last post by:
is using if(open("file",O_EXCL) != -1){ printf("File does exists")}else{printf("file does not exists"); } a good way of checking if a file exists or not, if not how should I do it ?
4
6064
by: Darrel | last post by:
I'm trying to add an extra layer of error checking on a Drop Down List. The list is populated from one table, and then I select the selectedValue from another DB. While it SHOULDN'T ever happen, just incase, I want to check that the selected value actually exists as a value in the dropDownList before I actually try to select it. I've tried this:
9
5671
by: D. Shane Fowlkes | last post by:
(ASP.NET 2 / VB) Question - How can I write a If statement to see if a control (textbox) actually exists on a page? Upon page_load, a certain control may or may not be visible on the page so I need to first check to see if it actually exists and then if it does, get the value from it. If I try to read it or check if its "visible" if it's not on the page then of course, it'll error. Thanks!
1
3586
by: Edwina Rothschild | last post by:
Hello, I am new to PHP so I have done a research on how to check if an entry exists on the table. I came up with the following code: include("dbinfo.inc.php"); $Name=$_POST; $Code=$_POST; mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database");
13
24198
by: darkslide | last post by:
Hi, I'm checking if a file exists with the following code; If System.IO.File.Exists("C:\test.txt") = True Then MsgBox("File Exists") Else MsgBox("File Does Not Exist") End If For some reason it always returns false even though the file does exist. Any suggestions? Could this be a security issue?
7
19125
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not have the necessary permissions. One hack could be to check for length and that would throw a FileNotFoundException ...but there is got to be a better way!
0
9582
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9157
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.