Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes HTML, CSS and JavaScript and the fly likes forward request using Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "forward request using Javascript " Watch "forward request using Javascript " New topic

forward request using Javascript

Bhushan Damle

Joined: Nov 28, 2004
Posts: 21
Can anybody tell me what actually does?
I think it redirects the current window to the new location.
Is there any way in javascript that can forward the request instead of redirect?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

No. The request being a server-side entity, you won't access it from Javascript, so forwarding it is not possible either.

[My Blog]
All roads lead to JavaRanch
Bhushan Damle

Joined: Nov 28, 2004
Posts: 21
Thanks for the reply.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
It's not a redirect either (which also makes sense only in the context of a server). Setting the href property replaces the current page with a different one, which leads to an HTTP request being sent to the server.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

Ulf's point is an important one. Many people talk about such changes in page location as "redirects" when, in fact, a redirect is a specific response received from the server that causes the browser to "redirect" to an alternate URL. Clicking a link or using JavaScript to change the page URL does not use the redirect mechanism.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: forward request using Javascript
It's not a secret anymore!