如何写"IF"字样? html中的条件以重定向到索引页"if",不是来自索引页 [英] How to write an "IF" condition in html to redirect to index page "if" not coming from index page
本文介绍了如何写"IF"字样? html中的条件以重定向到索引页"if",不是来自索引页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在html中编写"IF"条件以重定向到索引页面如果"访问者不是来自索引页面.
How to write an "IF" condition in html to redirect to index page "if" visitor is not coming from index page.
推荐答案
您可以使用 JavaScript [
You can use JavaScript[^] to do that:
<script type="text/javascript">
if (!document.referrer.endsWith('index.html'))
{
window.location.replace('index.html');
}
</script>
希望对您有所帮助.
Hope this helps.
首先,HTML不是具有功能的脚本语言.您将需要使用JavaScript,Classic ASP或其他脚本语言来完成此任务.
在Classic ASP中,这非常容易.您可以完全按照自己的意愿去做.只是做一些研究.
Well, first off, HTML is not a scripting language with functionality. You will need to use JavaScript, Classic ASP, or some other scripting language to accomplish this task.
It is pretty easy in Classic ASP. You can do exactly what you want. Just do some research.
这篇关于如何写"IF"字样? html中的条件以重定向到索引页"if",不是来自索引页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文