AMP

登出

與登入按鈕類似,「登出」按鈕的存在與否取決於 amp-access 元件的狀態

<button amp-access="loggedIn" amp-access-hide tabindex="0" on="tap:amp-access.login-sign-out" class="button-primary comment-button">Logout</button>

當您點擊「登出」按鈕時,您會被導向至您在 amp-access JSON 設定中指定的 URL,作為登入物件的一部分

{
"login": {
  "sign-in": "https://ampbyexample.com/samples_templates/comment_section/login?rid=READER_ID&url=CANONICAL_URL",
  "sign-out": "https://ampbyexample.com/samples_templates/comment_section/logout"
  }
}

與登入類似,當 AMPByExample 伺服器收到登出請求時,它會使用 AMP 函式庫自動新增的回傳 URL 查詢參數並重新導向至該網址,並新增 #success=true。此時,您會回到初始頁面;先前為登入頁面建立的 AMPByExample Cookie (名為 ABE_LOGGED_IN) 會在此時清除。