简体   繁体   中英

Full page postback and javascript data?

将从内存中执行整页回发清除javascript变量等吗?

In computing, a stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of requests and responses.

A stateless protocol does not require the server to retain session information or status about each communications partner for the duration of multiple requests. In contrast, a protocol which requires keeping of the internal state on the server is known as a stateful protocol.

Examples of stateless protocols include the Internet Protocol (IP) which is the foundation for the Internet, and the Hypertext Transfer Protocol (HTTP) which is the foundation of data communication for the World Wide Web.

As HTTP is stateless, so is javascript when used in a browser , with some exceptions, such as Ajax calls. No variables are kept in memory between page reloads, unless you use some sort of persistent storage, such as cookies, localStorage, sessionStorage, indexedDB etc. or use the server to store data about the current session or something similar.

In other words, each time a page is loaded, the styles and scripts are downloaded from the server or gotten from the cache if they are cached, and executed again, for every single pageload.

Yes, it will since when we doing a full page postback, we send the page back to the server and we wait to respond, sending us the page again. Then each script on the page or each referred script, will load from the start. So all the javascript variables would be reinitialized.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM