单击 AMP 故事 html 内容中的 <a> 标签时,无需提示即可即时重定向
Instant redirect without prompt when clicking an <a> tag inside an AMP Story html content
当我点击 AMP 故事页面内的 link 标签时,首先会打开提示,点击提示后页面会重定向。在没有提示的情况下单击 AMP 页面内的 link 时,有没有一种方法可以立即重定向?
https://pasteboard.co/IyTglV9.png
我尝试使用 on="tap" 事件来捕获点击,然后使用
.
AMP.navigateTo(URL=STRING, target=STRING, opener=BOOLEAN)
试图导航到 URL,但在控制台中抛出一些意外错误
订阅中的无效操作定义:[ tap:AMP.navigateTo(https://apto.gr, _blank, true) ] ;预计 [=]
显然,当我将 : 更改为 = 时,它会抛出相反的错误
...;预计 [:]
这是我正在使用的代码
<button on="tap:AMP.navigateTo(https://apto.gr, _blank, true)" href="https://apto.gr" target="_blank" class="adBtn i-amphtml-error" style="color:#f30809;background:#000000;">Subscribe</button>
使用标签有相同的结果。
<a on="tap:AMP.navigateTo(https://apto.gr, _blank, true)" href="https://apto.gr" target="_blank" class="adBtn i-amphtml-error" style="color:#f30809;background:#000000;">Subscribe</a>
我的 AMP.navigateTo 代码有问题吗?我认为这是我的解决方案,但我无法采取行动!
您无法在 AMP 故事正文中禁用重定向提示,除非您使用 amp-story-cta-layer
为什么?
当 AMP 专家设计 AMP 故事时,他们担心如果用户不小心点击故事上的链接并被重定向,会发生什么情况,从而使他们烦恼。这就是他们默认添加提示的原因。
唯一可以在没有提示的情况下点击和重定向的链接是位于 amp-story-cta-layer
内的链接。它必须是 amp-story-page
的最后一个元素,默认情况下,它占据故事宽度的 100% 和高度的 20%,并且固定在底部。这样就几乎不会出现误点击的情况。
代码如下:
<amp-story-cta-layer>
<a href="https://www.ampproject.org" class="button">Your link without prompt here</a>
</amp-story-cta-layer>
`
当我点击 AMP 故事页面内的 link 标签时,首先会打开提示,点击提示后页面会重定向。在没有提示的情况下单击 AMP 页面内的 link 时,有没有一种方法可以立即重定向? https://pasteboard.co/IyTglV9.png
我尝试使用 on="tap" 事件来捕获点击,然后使用 .
AMP.navigateTo(URL=STRING, target=STRING, opener=BOOLEAN)
试图导航到 URL,但在控制台中抛出一些意外错误
订阅中的无效操作定义:[ tap:AMP.navigateTo(https://apto.gr, _blank, true) ] ;预计 [=]
显然,当我将 : 更改为 = 时,它会抛出相反的错误 ...;预计 [:]
这是我正在使用的代码
<button on="tap:AMP.navigateTo(https://apto.gr, _blank, true)" href="https://apto.gr" target="_blank" class="adBtn i-amphtml-error" style="color:#f30809;background:#000000;">Subscribe</button>
使用标签有相同的结果。
<a on="tap:AMP.navigateTo(https://apto.gr, _blank, true)" href="https://apto.gr" target="_blank" class="adBtn i-amphtml-error" style="color:#f30809;background:#000000;">Subscribe</a>
我的 AMP.navigateTo 代码有问题吗?我认为这是我的解决方案,但我无法采取行动!
您无法在 AMP 故事正文中禁用重定向提示,除非您使用 amp-story-cta-layer
为什么?
当 AMP 专家设计 AMP 故事时,他们担心如果用户不小心点击故事上的链接并被重定向,会发生什么情况,从而使他们烦恼。这就是他们默认添加提示的原因。
唯一可以在没有提示的情况下点击和重定向的链接是位于 amp-story-cta-layer
内的链接。它必须是 amp-story-page
的最后一个元素,默认情况下,它占据故事宽度的 100% 和高度的 20%,并且固定在底部。这样就几乎不会出现误点击的情况。
代码如下:
<amp-story-cta-layer>
<a href="https://www.ampproject.org" class="button">Your link without prompt here</a>
</amp-story-cta-layer>
`