473,651 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1259
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.javas cript 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
4050
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 null ); create table if not exists nnet_produkt_farge ( nnet_produkt_farge_id int not null auto_increment, primary key(nnet_produkt_farge_id),
1
8884
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 automatically deletes also all those rows in the child table whose foreign key values are equal to the referenced key value in the parent row. However:
71
6466
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 a step beyond Notepad (not a WYSIWYG tool). Thanks.
82
6297
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 of getting wrong it seems I am on very shaky ground . For example, pretty much every book and web course on html that I have read tells me I must include <html>, <head> and <body> tag pairs. I have always done that, and never questioned it. ...
2
2327
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 href.match(/http:\/\/domain\.com\/\w?\.html/) and this will get me http://domain.com/path but not everything to
7
1909
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 on the foreign site. However, the information I got back was nonsensical. I'm guessing the code I get back from the web page is written in that foreign language, but when I -> of the same page, it looks like normal html code. Does anyone know...
5
2447
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 /* CSS for Marlon Sanders site */ html, body {
4
2496
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 extra copy of it called Natvrdo, since I modified the logo. Okay, I have this in my HTML (Natvrdo being the CSS style sheet) This is what I have in my index.html:
1
3216
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), and load the HTML from the page into a string variable. I want to parse out certain data from the source page, and display it on another web page. I've done this in VB, but am new to Java.
0
8275
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
8802
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
8697
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
8465
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
8579
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7297
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...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
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();...
1
1909
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.