Sample JavaScript Code for SonicOS 5.2

In this example, “blockedURL” is the variable that references the URL the client was trying to browse to. In this example, we are looking for facebook, and then taking a unique action for that URL. You could use this to redirect users or take custom actions against a defined list of URLs.

if (blockedURL=="http://www.facebook.com/") document.write("test"); This will write the word “test” in the block page.

if (blockedURL=="http://www.facebook.com/") window.location = "HTTP://www.yahoo.com"; This will redirect a user to yahoo.com.

Sample Code for SonicOS 5.1 or Earlier

<html>

<head>

<title>Your Page Title</title>

<meta HTTP-equiv="REFRESH" content="0;url=HTTP://x.x.x.x"></HEAD> <BODY>

Optional Info Here </BODY> </html>

NOTE: HTTP://x.x.x.x should reference the interface the user is terminating through. For example, if a user is coming from the LAN and your X0 LAN interface IP is 192.168.1.1 you would use HTTP://192.168.1.1

NOTE: SonicOS 5.1 and earlier have a 256 character limit on the CFS block page. SonicOS 5.2 increases this number greatly.

44

Page 44
Image 44
SonicWALL SonicWALL UTM Appliance manual Sample JavaScript Code for SonicOS, Sample Code for SonicOS 5.1 or Earlier