简体   繁体   English

如何在 amp html 中重定向?

[英]How to redirect in amp html?

I have this code for normal HTML website (redirect in 30 sec)我有这个普通 HTML 网站的代码(在 30 秒内重定向)

<div id="counter" style="text-align: center;">30</div>
<script>
        setInterval(function() {
            var div = document.querySelector("#counter");
            var count = div.textContent * 1 - 1;
            div.textContent = count;
            if (count <= 0) {
                window.location.href="https://example.com";
            }
        }, 1000);
    </script>

But I need this in amp html and I don't find anything on internet.但是我在 amp html 中需要这个,我在互联网上找不到任何东西。

AMP 不允许自定义 JavaScript,您将获得的最接近的是使用amp-bind (它不允许访问windowdocument )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM