10 examples of 'how to clear session using javascript' in JavaScript

Every line of 'how to clear session using javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
116clearSession() {
117 if (window.sessionStorage) window.sessionStorage.clear();
118}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

40static clearSessionStorage(): promise.Promise<any> {
41 return browser.executeScript('window.sessionStorage.clear();');
42}
15static clear() {
16 sessionStorage.clear();
17}
106function clear (key) {
107
108 if (!window.localStorageSupport) {
109 return;
110 }
111
112 window.localStorage.removeItem(key);
113}
154static sessionStorageClear() {
155 sessionStorage.clear();
156}
8clear() {
9 this.session.destroy();
10}
366async clearCookies(): Promise<void> {
367 const { Network } = this.client
368 const canClearCookies = await Network.canClearBrowserCookies()
369 if (canClearCookies) {
370 await clearCookies(this.client)
371 this.log('Cookies cleared')
372 } else {
373 this.log('Cookies could not be cleared')
374 }
375}
6clear()
7{
8 if (!this.isSupported()) return;
9 sessionStorage.clear();
10}
15public Clear(): void {
16 window.sessionStorage.clear();
17}
125clearSession(options = {}) {
126 const {client, agent, domain, clientId} = this;
127 options.clientId = clientId;
128 options.returnTo = callbackUri(domain);
129 options.federated = options.federated || false;
130 const logoutUrl = client.logoutUrl(options);
131 return agent.show(logoutUrl, true);
132}

Related snippets