假定页的基 URL 为:
http://abc.sesta.com/test/rewriter/test1/jscript/test2/page.html
页内容
<script language="JavaScript"> <!-- function test(one,two,three){ alert(one + "##" + two + "##" +three); } test("/test.html","../test.html","123"); window.open("/index.html","gen",width=500,height=500); //--> </SCRIPT>
规则
<Function name="URL" name="test" paramPatterns="y,y,"/> <Function name="URL" name="window.open" paramPatterns="y,,,"/>
输出
<SCRIPT language="JavaScript"> <!-- function test(one,two,three) { alert(one + "##" + two + "##" +three); } test("gateway-URL/http://abc.sesta.com/test.html"," gateway-URL/http://abc.sesta.com/test/rewriter/ test1/jscript/test.html","123");window.open("gateway-URL/ http://abc.sesta.com/index.html","gen",width=500,height=500); //--> </SCRIPT>
描述
第一项规则指定需要重写名为 test 的函数中的前两个参数。因此会重写 test 函数的前两个参数。第二项规则指定需要重写 window.open 函数的第一个参数。会在 window.open 函数中的 URL 前面加上网关 URL 以及包含函数参数的页的基 URL。