Access cookies through an API on AMP page

前端 未结 1 630
你的背包
你的背包 2021-02-06 18:33

I am converting a page to google AMP and need to access cookies to set a view of a division. I am thinking of creating an API for this.

The API will just return all the

相关标签:
1条回答
  • 2021-02-06 18:51

    Using amp-list is the right approach in this case. amp-list makes a request to your server, which can read the cookie and return an appropriate JSON response. You can render then the form / button inside the amp-list using amp-mustache.

    This samples demonstrates how to do this: https://ampbyexample.com/advanced/favorite_button/.

    0 讨论(0)
提交回复
热议问题