登出
與登入按鈕類似,「登出」按鈕的存在與否取決於 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 設定中指定的網址 (屬於登入物件的一部分)
{ "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 程式庫自動新增的回傳網址查詢參數並重新導向至該網址,並加入 #success=true
。此時,您會回到初始頁面;先前為登入頁面建立的 AMPByExample Cookie (名為 ABE_LOGGED_IN
) 會在此時清除。