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

Finding out if a HTML page in a foreign domain exists before youallow navigation to it

Does anyone know of a way to check if a html file exists in a different
domain so that you can know in advance whether going there would result
in a 404? I believe Ajax would allow that in the same domain, but
wouldn't in a different domain. The page I might go to is totally out of
my control, so I can't do anything that side. I'm expecting this won't
be possible, but figured I'd ask.
Feb 22 '08 #1
6 1240
Stevo said the following on 2/22/2008 11:37 AM:
Does anyone know of a way to check if a html file exists in a different
domain so that you can know in advance whether going there would result
in a 404? I believe Ajax would allow that in the same domain, but
wouldn't in a different domain. The page I might go to is totally out of
my control, so I can't do anything that side. I'm expecting this won't
be possible, but figured I'd ask.
No. Not on an internet site anyway. I could dream up a way to do it
running locally though.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 22 '08 #2
Randy Webb wrote:
Stevo said the following on 2/22/2008 11:37 AM:
>Does anyone know of a way to check if a html file exists in a
different domain so that you can know in advance whether going there
would result in a 404? I believe Ajax would allow that in the same
domain, but wouldn't in a different domain. The page I might go to is
totally out of my control, so I can't do anything that side. I'm
expecting this won't be possible, but figured I'd ask.

No. Not on an internet site anyway. I could dream up a way to do it
running locally though.
Thanks, figured as much.
Feb 22 '08 #3
Stevo wrote:
Does anyone know of a way to check if a html file exists in a different
domain so that you can know in advance whether going there would result
in a 404? I believe Ajax would allow that in the same domain, but
wouldn't in a different domain. The page I might go to is totally out of
my control, so I can't do anything that side. I'm expecting this won't
be possible, but figured I'd ask.
If it's a page on a server you control, you could have a link-checking
process on the server which checked your pages and disabled broken links.
That's entirely on the server side.

If it's on a client you control, you could write a Greasemonkey script
to check links on each page as it is loaded. But the overhead would be
high.

What are you trying to do?

John Nagle
SiteTruth
Feb 24 '08 #4
On Feb 23, 10:32*pm, John Nagle <na...@animats.comwrote:
Stevo wrote:
Does anyone know of a way to check if a html file exists in a different
domain so that you can know in advance whether going there would result
in a 404? I believe Ajax would allow that in the same domain, but
wouldn't in a different domain. The page I might go to is totally out of
my control, so I can't do anything that side. I'm expecting this won't
be possible, but figured I'd ask.

* * If it's a page on a server you control, you could have a link-checking
process on the server which checked your pages and disabled broken links.
That's entirely on the server side.

* * If it's on a client you control, you could write a Greasemonkey script
to check links on each page as it is loaded. *But the overhead would be
high.

* * What are you trying to do?

* * * * * * * * * * * * * * * * * * * * John Nagle
* * * * * * * * * * * * * * * * * * * * SiteTruth
this can be accoplished with Ajax, PHP, & Curl. Curl is an extention
for php. With it you can retieve alot a information on a site/page
including the status.

Hope that helps!
Adam
Feb 24 '08 #5
John Nagle wrote:
Stevo wrote:
>The page I might go to is totally out of my control
If it's a page on a server you control, you could have a link-checking
process on the server which checked your pages and disabled broken links.
That's entirely on the server side.
Sadly it's not :(
If it's on a client you control, you could write a Greasemonkey script
to check links on each page as it is loaded. But the overhead would be
high.

What are you trying to do?
I was asked if I could provide some JavaScript that could check whether
a regular link to a different site would result in a 404. I said that I
was 99% sure it couldn't be done but I'd ask around.
Feb 24 '08 #6
ad******@gmail.com wrote:
On Feb 23, 10:32 pm, John Nagle <na...@animats.comwrote:
>Stevo wrote:
>>Does anyone know of a way to check if a html file exists in a different
domain so that you can know in advance whether going there would result
in a 404? I believe Ajax would allow that in the same domain, but
wouldn't in a different domain. The page I might go to is totally out of
my control, so I can't do anything that side. I'm expecting this won't
be possible, but figured I'd ask.
this can be accoplished with Ajax, PHP, & Curl. Curl is an extention
for php. With it you can retieve alot a information on a site/page
including the status.
Hope that helps!
Adam
Unfortunately I would only have Javascript available for this.
Feb 24 '08 #7

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

Similar topics

4
by: Phil Powell | last post by:
create table if not exists nnet_produkt_varegruppe ( nnet_produkt_varegruppe_id int not null auto_increment, primary key(nnet_produkt_varegruppe_id), nnet_produkt_varegruppe_navn varchar(255) not...
1
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB...
71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
2
by: jd | last post by:
hi all, i'm using regular expression to find the url of the page to be opened using the window.open(). typical urls look like this http://domain.com/path-to-page.html right now i'm trying...
7
by: alnoir | last post by:
I'm working on this script that grabs a web page from a foreign site, searches it for specific information, and grabs web pages from links on the original page. Once I had it working, I tried it out...
5
by: smittie31 | last post by:
I am having a problem with a border around me html page. The border does not flow thru the whole html page, it cuts off halfway. --> See http://keithborom.com/marlon-sanders CSS STYLESHEET ...
4
by: z55177 | last post by:
My domain: http://www.esthevision.cz/ This is the cause of my problem. The template is supposed to look somewhat like this: PINK STRIPE http://themebot.com/website-templates/ht... I created an...
1
by: Don S | last post by:
Hi All. Is there a way in Javascript to retrieve the HTML text from a webpage, without actually opening the web page? For example, specify a web page (it's actually the reply to an HTTP GET),...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.