网站跳转代码的实现途径

第一种:
如果你要让域名页面显示几秒钟之后跳转,可以在html代码的<head></head>部分加上这样的域名跳转代码:
<meta http-equiv="refresh" content="3; url=http://将这里改成要跳转的域名">

第二种:
不隐藏域名跳转之后的地址
<html>
<body>
<meta http-equiv="refresh" content="0.1;url=将这里改成要跳转的域名">
</body>
</html>

第三种:
可隐藏域名跳转之后的地址:
<html>
<frameset framespacing="0" border="0" rows="0" frameborder="0">
<frame name="main" src="将这里改成要跳转的域名" scrolling="auto" noresize>
</frameset>
</html>

第四种:
定时的域名跳转代码
<meta http-equiv="refresh" content="3;rul=http://将这里改成要跳转的域名">
此代码可以让网页在一定的时间内,跳转到另外一个网页上,其中content=" 为跳转前停暂的秒数,rul= 为跳转的域名

第五种:
如果你的域名要在客户端跳转,可以这样:<script language="javascript" type="text/javascript">window.location="http://将这里改成要跳转的域名";;</script>

第六种:
域名在服务器端跳转Response.Redirect(http://将这里改成要跳转的域名)Response.End

第七种:

放在body的里面

<script language="javascript">window.location.href= 'https://www.hsgjyl.com/';</script>

第八种

PC端与WAP移动端的识别

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PC端与手持移动端的识别</title>
<script type="text/javascript">
function browserRedirect() {
    var sUserAgent = navigator.userAgent.toLowerCase();
    var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
    var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
    var bIsMidp = sUserAgent.match(/midp/i) == "midp";
    var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
    var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
    var bIsAndroid = sUserAgent.match(/android/i) == "android";
    var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
    var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
   
    if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
       window.location.href=https://m.baidu.com;//输入移动端网址
    } else {
       window.location.href="https://www.baidu.com"; //输入PC端网址
    }  
}
browserRedirect();

</script>
</head>
<body>
</body>
</html>

 

posted @ 2017-05-05 11:25  LZG886  阅读(356)  评论(1编辑  收藏  举报