重定向到另一个页面,如果禁止javascript [英] redirect to another page if javascript is disabled
问题描述
我已经通过JavaScript实现的功能的很多,如果在任何阶段的JavaScript被禁止,他应该被重定向到另一个页面。提他启用JavaScript,然后继续。
这个功能应该是跨浏览器compatable
对此,
i have a alot of functionality implemented through javascript if at any stage the javascript is disabled he should be redirected to another page. mentioning him to enable the javascript and then proceed. and this functionality should be cross browser compatable Regard,
推荐答案
使用<无脚本
>标签,检查是否启用JavaScript或不< META HTTP-EQUIV =刷新内容=0; URL = HTTP://www.google.com/>
将其重定向到指定的url.Here在这个例子中它会重定向到谷歌。
Use <noscript
> tag to check whether JavaScript is enabled or not.<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com/">
will redirect it to the specified url.Here in this example it will redirect to the google.
下面是一个例子。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>How To Detect If User Javascript Is Enabled</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<p>The Purpose of this script is to show if you have javascript enabled in your browser.</p>
<p class="style1">
<script type="text/javascript">
document.write('Javascript is enabled');
</script>
<noscript>
Javascript is disabled.
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.google.com/">
</noscript>
</p>
</p>
</body>
</html>
这篇关于重定向到另一个页面,如果禁止javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!