This sample can be accessed from:
portal-server-URL/rewriter/JavaScript/variables/system/system.html
Add the rule specified in this sample (if it does not already exist) to the default_gateway_ruleset in the section "Rules for Rewriting JavaScript Source".
Edit the default_gateway_ruleset in the Rewriter service under Portal Server Configuration in the Portal Server administration console.
Restart the Gateway:
./psadmin start-sra-instance –u amadmin – f <password file> –N <profile name>– t <gateway> |
<html>
<head>
<title>JavaScript SYSTEM Variables Test Page</title>
</head>
<body>
<script LANGUAGE="Javascript">
<!--
//SYSTEM Var
alert(window.location.pathname);
//document.write
("<A HREF="+window.location.pathname+">SYSTEM</A><P>")
//-->
</SCRIPT>
Testing JavaScript SYSTEM Variables
<br>
This page displays the path where
the current page is located when loaded.
</body>
</html>
<Variable name=”window.location.pathname” type="SYSTEM"/>
<html> <head> <title>JavaScript SYSTEM Variables Test Page</title> </head> <body> <SCRIPT> convertsystem function definition... </SCRIPT> <script LANGUAGE="Javascript"> <!-- //SYSTEM Var alert(psSRAPRewriter_convert_system (window.location, window.location.pathname,”window.location”));
// Rewriter identifies window.location.pathname as a JavaScript SYSTEM variable. The value of this variable cannot be determined at the server end. So the Rewriter prefixes the variable with the psSRAPRewriter_convert_pathname function. This wrapper function determines the value of the variable at the client end and rewrites as required.
//--> </SCRIPT> Testing JavaScript SYSTEM Variables <br> This page displays the path where the current page is located when loaded. </body> </html>