Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is window.location() same as a GET request?

Are cookies preserved while doing windows.location(url), if domain of url is the domain of the current page?

like image 934
Nullpoet Avatar asked Dec 24 '09 12:12

Nullpoet


People also ask

What is difference between window location or location?

window. location is an object that holds all the information about the current document location (host, href, port, protocol etc.). location. href is shorthand for window.

What does window location mean?

The location property of a window (i.e. window. location ) is a reference to a Location object; it represents the current URL of the document being displayed in that window. Since window object is at the top of the scope chain, so properties of the window.

What is the function of window location?

The window. location object can be used to get the current page address (URL) and to redirect the browser to a new page.


1 Answers

To be really pedantic, changing window.location in Javascript will cause the browser to go to another site, which includes making a GET request. In other words, a GET request and Javascripts window.location are two completely different things; one is a type of HTTP request, the other a DOM attribute.

As pertains to the question though, they can be considered equivalent. Cookies are preserved.

</pedantry> :)

like image 81
deceze Avatar answered Sep 28 '22 04:09

deceze