Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

Not native
This feature is not built into all browsers. To use it reliably, you'll need to include a JavaScript library in your page as a polyfill. You can include the library from https://login.persona.org/include.js.

Summary

This function is used in Persona to cause the browser to reset the automatic / persistent login flag for a website. After being called, the user will need to explicitly log back into your site instead of being signed in automatically.

Websites must call this function in the click handler for the site's "log out" button.

This function does not make the browser clear the user's certificate and signing key. So after calling logout(), a new login attempt may or may not ask the user for a new password, depending on the freshness of the certificate their identity provider gave them. However, it will certainly prompt the user to select an email address and confirm that they want to sign in.

Syntax

navigator.id.logout();

Example

// Execute navigator.id.logout(); when the user clicks "Sign Out"
var signoutLink = document.getElementById('signout');

if (signoutLink) {
  signoutLink.onclick = function(event) {
    event.preventDefault();
    navigator.id.logout();
  };
};

Specification

Not included in any specification.

See also

文档标签和贡献者

 此页面的贡献者: teoli, MHasan, wbamberg, kscarfone, Sheppy, ethertank, dhesinoiiz, Callahad
 最后编辑者: teoli,