Does window.open() take over the session?

Asked 1 years ago, Updated 1 years ago, 21 views

If you open a new window in JavaScript's window.open(), do you have any standard specifications for whether the session will be taken over?
Or do you decide on your own for each browser?

Let's make the session take over a little bit more specific:

As far as I checked with Chrome 51 and IE11, both of them were as follows:

I'm trying to create an application that assumes this behavior, but if this is the proprietary specification of an individual browser, I'm hesitating because it's likely to change behavior in the near future.

javascript

2022-09-30 14:06

1 Answers

SessionStorage content is copied to a child window when window.open, but is independent and does not synchronize after that

It seems that the browser is not proprietary.

https://html.spec.whatwg.org/multipage/webstorage.html#the-sessionstorage-attribute

When a new top-level browsing context is created by a script in an existing browsing context, or by the user following a link in an existing browsing context, or in some other way related to a specific Document, and the creation is not a new start for session storage, then the session storage area of the origin of that Document must be copied into the new browsing context when it is created. From that point on, however, The two session storage are as must be considered separate, not affecting each other in any way.

Will the session cookie be the same as the one in the parent window?

Since cookies are handed over from the server, isn't it dependent on the behavior of the server?
If window.open('http://google.com'), the cookie value will not be taken over, right?

HTTP State Management Mechanism


2022-09-30 14:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.