/    Sign up×
Community /Pin to ProfileBookmark

test if webpage exist

Hello,
Building a multilingual website, it could appears that some pages are not yet translated.
Therefore I would like to inform the visitors of the available pages.
IF there a way to test if a page is present on the website ?

! Javascript on html pages no php or ….

Many thanks for your help.

Francois.

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYSep 06.2005 — you might want to try the [URL=http://us2.php.net/manual/en/function.file-exists.php]file_exists()[/URL] php function
Copy linkTweet thisAlerts:
@vandecanauthorSep 06.2005 — Sorry no php code in my website (server restriction)
Copy linkTweet thisAlerts:
@herodote92Sep 06.2005 — You could prepare blank pages mentioning "Sorry, translation coming soon" ? That would be rather fast and easy to do.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYSep 06.2005 — Sorry no php code in my website (server restriction)[/QUOTE]
sorry i didn't see the "no php" in the first post! :o
Copy linkTweet thisAlerts:
@vandecanauthorSep 06.2005 — You could prepare blank pages mentioning "Sorry, translation coming soon" ? That would be rather fast and easy to do.[/QUOTE]

CORRECT? but this is not what I intend to do because it's not user friendly. What i would like to do is to propose other languages (the ones available) to the visitors.

Is there any chance to have someone helping me with code to test if a page exist or not on the website ?

Thanks.

Francois
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYSep 06.2005 — in javascript?
Copy linkTweet thisAlerts:
@vandecanauthorSep 07.2005 — Yes Javascript would be perfect !

Thanks.
Copy linkTweet thisAlerts:
@BigMoosieSep 07.2005 — This function will take you to the specified file if it exists and will alert if it does not:

function findFile(path){
var http;
http = (h=window.XMLHttpRequest)?new h():((h=window.ActiveXObject)?new h("Microsoft.XMLHTTP"):0);
if (!http) {
// do something for browsers that do not support xmlHTTP
return false;
}
http.open("HEAD", path, true);
http.onreadystatechange=function() {
if (http.readyState==4) {
if (http.status==200) window.location.href=path;
else alert("URL doesn't exist!");
}
}
http.send(null);
}
×

Success!

Help @vandecan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...