473,320 Members | 1,953 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,320 software developers and data experts.

Performing web request

Hi!

Is it possible to perform a webrequest within javascript to find out if a
given url is reachable? (If it isn't then show a placeholder image).
The url can point to both images, video or regular websites.

best regards
Hansen
Sep 4 '06 #1
2 1702
Hi,

Hansen wrote:
Hi!

Is it possible to perform a webrequest within javascript to find out if a
given url is reachable? (If it isn't then show a placeholder image).
The url can point to both images, video or regular websites.

best regards
Hansen
http://www.galasoft-lb.ch/myjavascript/IsURlActive/

Code:
http://www.galasoft-lb.ch/myjavascri.../check-url.txt

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 4 '06 #2
Sorry for replying my own post, but this calls for more information.

Laurent Bugnion wrote:
Hi,

Hansen wrote:
>Hi!

Is it possible to perform a webrequest within javascript to find out
if a given url is reachable? (If it isn't then show a placeholder image).
The url can point to both images, video or regular websites.

best regards
Hansen

http://www.galasoft-lb.ch/myjavascript/IsURlActive/

Code:
http://www.galasoft-lb.ch/myjavascri.../check-url.txt

HTH,
Laurent
Note: This will work only within the "cross-domain" policy. You cannot
(with the normal permissions) send such a request to another domain.
However, images can send requests to another domain, so this code might
not be sufficient.

Another way would be to use the onerror event handler of the Image object:

<img src="myImage.gif" id="myImage" onerror="showDefaultImage();" />

with

function showDefaultImage()
{
var nImage = document.getElementById( "myImage" );

if ( nImage
&& nImage.src )
{
nImage.src = "iAmSureThatThisImageExists.gif";
}
}

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 4 '06 #3

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

Similar topics

3
by: special_agent69 | last post by:
Not sure if this is a stoopid question or not. If it is, my apologies. I'd like to have an ASP form performing a relatively simple calculation. For example, if I wanted to create a simple...
3
by: Clifford Schneider | last post by:
Hello, I have several SQL Server jobs that execute procedures written to run deletes and updates against tables in my data warehouse. Some jobs occasionally get stuck with the status "Performing...
0
by: Gene Ellis | last post by:
Thanks for reading my posting. We are running an Apache webserver on a Linux machine. For whatever reason, our nerver admin cannot get the XSLT libraries installed for PHP which would enable us to...
3
by: Paul van Hagen | last post by:
Hello, I've been doing some research as to ways to optimise our parsing and evaluation of mathematical expressions and came across the spirit template library as part of the boost library. It...
0
by: Mossman | last post by:
Hello, I posted this problem in another thread and received no response. I need some input at what to look at next. So, if anyone out there as any suggestions, please respond to this message....
3
by: Lisa Burks | last post by:
I have two problems I am trying to solve. 1) I am needing to be able to double-click on a list and have it open another form with the details. I will need the detailed form to be a stand alone...
0
by: Satheshkumar | last post by:
Dear Sir/Madam, I am Sathesh, i am working as a Software Engineer in one software concern. In my project work, I will need to install the Microsoft .NET FrameWork1.1 and Microsoft VJ#...
2
by: ashwinij | last post by:
Hello The steps which i am doing in my program 1) I am having an xml file. 2) I am performing some updations in the file using XQueryUtil class from nux package. 3)After that i am...
8
by: Sham | last post by:
I am trying to perform the following query on a table that has been indexed using Full Text Search. The table contains multiple columns than have been indexed. (Below, all xml columns are...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.