【发布时间】:2019-09-08 06:28:22
【问题描述】:
我想从 AMP 网页 的 canonical 网址获取 href 并将其添加到一个 AMP 按钮,在按钮 tap 上,事件会打开一个带有规范 URL 的新页面。
我想通过代码动态地做到这一点。
我可以使用 amp-binding,但我不想将任何 amp-binding 添加到规范 URL。
这是我的 AMP 代码,其中包含 canonical URL,我希望在 点击 销售按钮后导航到该代码。
注意:在 AMP 中,您点击一个按钮,然后触发一个操作,而在 HTML 中您会说 click。
有人知道怎么做吗,请告诉我怎么做?
<link rel="canonical" href="https://mysaleswebsite.com/salepage.php"/>
<div align="center" class="img-wrapper">
<amp-img on="tap:AMP.navigateTo(url='GET_URL_FROM_CANONICAL_LINK#productX', target='_blank', opener=true)" src="img/salesbuttonpicture.jpg" height="50" width="100" alt="Sales Page">
</amp-img>
</div>
【问题讨论】:
标签: javascript html amp-html