/    Sign up×
Community /Pin to ProfileBookmark

Get Response code for a Url

Is there any way in JavaScript by which I can check the Response code for any page.

My requirement:
User will be entering a Url in Textbox, on click of a button I have to check if the response code (200, 404, 400, 301 etc) for that Url and display it. This needs to be done with some Javascript.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@DokSep 17.2008 — You can use Ajax to do this but you probably need some server side languge as well.
Copy linkTweet thisAlerts:
@hello_vcauthorSep 17.2008 — I am wondering is there is no plain JavaScript way to do this?
Copy linkTweet thisAlerts:
@DokSep 17.2008 — You can not access HTTP headers without using some Ajax.
Copy linkTweet thisAlerts:
@rnd_meSep 17.2008 — a javascript-only solution will be limited to checking the status of pages within the same site as the application page.
×

Success!

Help @hello_vc 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...