假設此網頁的基準 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。