javascript URL rewirte

I know Ive read this some where.... any one know how to do a URL rewrite in javascript... It was the url in the browser... If I remember right the article was saying that you could do this for when you were using ajax... anyone have an idea on this... thank you for the help...
Who is Participating?

Improve company productivity with a Business Account.Sign Up


pure URL rewrite  using javascript not is possible; a URL rewrite consist in transform a not existing URL into a resource on server, client side transparent.

Obviously, you can check the URL on your error 404 html page (if you can not run scripts on server) and process the document.location.href for redirect client on javascript runtime.

do you understand?

an example of your 404 html page would be

switch( location.href ) {
case 'http://.../a-page': location.href = '/a.htm'; break;
case 'http://.../b-page': location.href = '/b.htm'; break;
case 'http://.../c-page': location.href = '/c.htm'; break;
Page not found!

Open in new window

jeremyBass26Author Commented:
I think I was not clear, or it just the thought... but what I was wanting to do is stop some HTTP requests at the cleint side.... basicaly I have a file being called 12-20 times... but it's the same file.. so the thought was there has to be a way to "capture" the HTTP requests ... I thought I've seen URL rewrites with javascript... but may-be I could have it so that it's more like this... if HTPP request is in array die else execute and push URL to array?  any ideas on that? thanks for the help
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.


In a general case, you can not stop a request petition, probably you like control all links elements on your page and, when user click then check a posible rewrite. is it?
jeremyBass26Author Commented:
No this is for when an element is called... in this case a link to a swf file.... it's one file that is being called many times ... also it's all in the jQuery script so that thought was that I could do something like "capture" the HTTP requests ... so if HTPP request is in array die else execute and push URL to array? I think... thanks for the help
jeremyBass26Author Commented:
that was the articel I have been looking for... thank you...
jeremyBass26Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.