This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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

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: 42061
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.

Ping & DNS - my free Android networking tools app
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61318

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] [Bear's FrontMan] [About Bear] [Books by Bear]
GeeCON Prague 2014
subject: forward request using Javascript