JSP根据IP段跳转不同页面的问题
String remoteHost = request.getRemoteHost();
得到ip地址,并对ip访问进行限制:
HTTP Header referer这玩意主要是告诉人们我是从哪儿来的,就是告诉人家我是从哪个页面过来的,可以用于统计访问本网站的用户来源,也可以用来防盗链。获取这个东西最好的方式是js,如果在服务器端获取(方法如:Request.Headers["Referer"]) 不靠谱,人家可以伪造,用js获取最好,人家很难伪造,方法:利用js的 document.referer 方法可以准确地判断网页的真实来路。 目前百度统计,google ads统计,CNZZ统计,都是用的这个方法。防盗链也很简单了,js里判断来路url如果不是本站不显示图片
在IE中用javascript做跳转,比如用window.location.href = “http://www.google.com”; google无法取到浏览器请求的,因为IE清空了document.referrer
而其他主流浏览器Firefox和Chrome都会保留referrer,这意味着IE又要享受“部长级”特殊待遇了:
1 | if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ |
2 | var referLink = document.createElement( 'a' ); |
3 | referLink.href = url; |
4 | document.body.appendChild(referLink); |
5 | referLink.click(); |
6 | } else { |
7 | location.href = url; |
8 |
|
先给大家一个最简单,好用的JS调用代码:
网页自动跳转JS代码<script type="text/java script"> document.location.href = " "; </script>将里面的改成你自己的地址就可以了. 下面给大家介绍的是网上乱七八糟找的,综合供大家看看.
------------------------------------------------------------------------------
不隐藏转向之后的地址 代码一------------------------------------------------------------------------------ <html><head><meta http-equiv="Content-Language" content="zh-cn"><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"><title></title></head><body><form name=loading><P align=center><FONT face=Arial color=#0066ff size=2>loading...</FONT> <INPUT size=46 name=chart> <BR><INPUT size=47 name=percent><SCRIPT> var bar=0 var line="||" var amount="||" count() function count(){ bar=bar+2 amount =amount + line document.loading.chart.value=amount document.loading.percent.value=bar+"%" if (bar<99) {setTimeout("count()",100);} else {window.location = "将这里改成要转入的网址";} }</SCRIPT></P></form></body></html>-------------------------------------------------------------------------------不隐藏转向之后的地址 代码二
------------------------------------------------------------------------------- <html><body><script language="java script"><!--function goToURL() { //v2.0for (var i=0; i< (goToURL.arguments.length - 1); i+=2) //with arg pairseval(goToURL.arguments+".location='"+goToURL.arguments[i+1]+"'");document.returnvalue = false;}//--></script><body bgcolor="#FFFFFF" onLoad="goToURL('parent','将这里改成要转入的网址');return document.returnvalue"></body></html>-------------------------------------------------------------------------------不隐藏转向之后的地址 代码三
------------------------------------------------------------------------------- <html><head><meta http-equiv="Content-Language" content="zh-CN"><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"><title></title></head><SCRIPT LANGUAGE="java script"><!-- Start Codevar ver = navigator.appVersion;if (ver.indexOf("MSIE") != -1){ window.location.href="将这里改成要转入的网址"}elsewindow.location.href="将这里改成要转入的网址"// End Code --></SCRIPT></html>-------------------------------------------------------------------------------不隐藏转向之后的地址 代码四
------------------------------------------------------------------------------- <html><head><meta http-equiv="Content-Language" content="zh-CN"><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"><title></title></head><body><meta http-equiv="refresh" content="0.1;url=将这里改成要转入的网址"></body></html>-------------------------------------------------------------------------------可隐藏转向之后的地址
-------------------------------------------------------------------------------<html><head><meta http-equiv="Content-Language" content="zh-CN"><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"><title></title></head><frameset framespacing="0" border="0" rows="0" frameborder="0"><frame name="main" src="将这里改成要转入的网址" scrolling="auto" noresize></frameset></html>透明Flash的设置++++++++++++++++++++++++++++++++++++++++++++++++++主要是在Flash代码段中插入这一语句:<param name=wmode value=transparent>,请看以下实例:<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%">
<param name="movie" value="../images/hudie.swf"><param name="quality" value="high"><param name=wmode value=transparent> <!--这个代码表示背景透明--!><embed src="../images/hudie.swf" width="100%" height="100%" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object> html中跳转最全代码程序代码<html><head><meta name="GENERATOR" content="Microsoft FrontPage 5.0"><meta name="ProgId" content="FrontPage.Editor.Document"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>正在进入</title></head><body><form name=loading> <p align=center> <font color="#0066ff" size="2">正在进入,请稍等</font><font color="#0066ff" size="2" face="Arial">...</font> <input type=text name=chart size=46 > <input type=text name=percent size=47 > <script> var bar=0 var line="||" var amount="||" count() function count(){ bar=bar+2 amount =amount + line document.loading.chart.value=amount document.loading.percent.value=bar+"%" if (bar<99) {setTimeout("count()",100);} else {window.location = "http://www.txasp.com/";} }</script> </p> </form> <p align="center"> 如果您的浏览器不支持跳转,<a href="http://www.txasp.com/"><font color="#FF0000">请点这里</font></a>.</p></body></html> html的meta方式这种方法的好处是可以控制重定向的时间程序代码<meta http-equiv='Refresh' content='0;URL=index.html'> 在 <body> 里添加代码程序代码<body οnlοad="location.href='http://www.txasp.com/'">