ÀûÓÃhttpµÄrefererÍ·ºÍServletÒþ²ØJavaScript´úÂë
1. ¶¨ÒåÒ»¸öÓÃÓÚÊä³öJavaScript´úÂë µÄServletÀà¡£
package com.mycompany.response.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HideJavaScript extends HttpServlet {
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setContentType("text/javascript;charset=UTF-8");
PrintWriter out = response.getWriter();
String referer = request.getHeader("referer");
if(!(referer==null)&&!referer.equalsIgnoreCase("")&&referer.startsWith("http://localhost:8080/response/"))
{
out.println("document.write('ÕâЩ¾ÍÊÇÒþ²ØµÄJavaScript´úÂë!')");
out.println("window.alert('Ö´ÐÐÁË´Ë´úÂë!')");
}
&n
Ïà¹ØÎĵµ£º
µÚÒ»ÖÖ:
<!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>ÎÞ±êÌâÎ ......
LuaÓëjavascriptµÄ²îÒì - [luaѧϰ]
תÔØ
http://huazjxy.blogbus.com/logs/60132016.html
LuaÄ£ÄâÆ÷js·½°¸
1.Óï·¨¼¶Ä£Äâ
luaÓëjsÓïÑÔ²îÒì
1.1×¢ÊÍ
js Ϊ//,luaΪ--.
1.2±äÁ¿
jsÀûÓÃvalÀ´ÉùÃ÷È«¾Ö±äÁ¿²»´æÔÚ¾Ö²¿±äÁ¿£¬luaÔò²»ÐèÒªÖ±½Ó¶¨Î»ÔòΪȫ¾Ö±äÁ¿£¬localÉùÃ÷ÔòΪ¾Ö²¿±äÁ¿¡£
1.3ÔËËã·û
js
+ - ......
/**
* JavaScript ÊÇÃæÏò¶ÔÏóµÄÓïÑÔ£¬µ«ÊÇËûµÄÃæÏò¶ÔÏó²»ÊÇ»ùÓÚÀàµÄ£¬ÊÇ»ùÓÚÔÐ͵Ä;
* µ«ÊÇËûµÄһЩÌØÐÔ(º¯ÊýÊÇÊý¾Ý)£¬Ê¹µÃËü¿ÉÒÔÄ£Äâ»ùÓÚÀàµÄÃæÏò¶ÔÏ󣬵«ÊÇ JavaScript ²¢²»Ö§³ÖºÍ Java Ò»ÑùµÄÀ࣬
* Òò´Ë JavaScript ÖеÄ"Àà"¿ÉÒÔ³Æ×÷"αÀà"
*/
//
/**
* ¹¹Ô캯Êý: js ÖÐÓÃÀ´ºÍ new ÔËËã·ûÒ»ÆðʹÓõĺ¯Êý³Æ× ......
¡¡´Ó2004ÄêÏ°ëÄ꿪ʼѧϰWeb±à³ÌÖÁ½ñ3ÄêÓÐÓà¡£´ÓHTML£¬asp¿ªÊ¼µ½ÏÖÔÚµÄVS2008һ·ѧ¹ýÀ´£¬ÆäÖÐѧµÄ×î¶àµÄ»¹ÊÇ·þÎñÆ÷¶Ë±à³Ì£¬¶Ô¿Í»§¶Ë±à³ÌµÄѧϰ»¹ÊDz»³Éϵͳ¡£ËäÈ»Ôںܶà¸öϵͳÀïÃæÓ¦Óùý½Å±¾£¬ÓÐЩ»¹Æðµ½Á˱ȽÏÖØÒªµÄ×÷Óᣵ«Ò»Ö±ÊÇÖ»ÖªÆäÈ»²»ÖªÆäËùÒÔÈ»£¬ÓõÄÊÇСÐÄÒíÒí¡£ÏÖÔڽű¾±à³Ì´ÓÒÔÇ°µÄ"µñ³æС¼¼"±ä³ÉÁËÒ»¸öWeb¿ª ......
<!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; ......