html.neuterJavaScript

Syntax html.neuterJavaScript (s, legalProtocolSchemes=nil)

Params s is a string that may contain script code that you want to neuter.

legalProtocolSchemes is an optional list containing a list of legal schemes. If not supplied, the default list is used.

Action Renders JavaScript and similar script code non-executable by a Web browser.

Returns The string.

Examples html.neuterJavaScript ("<script>Foo</script>") //script tags are neutered

   » "&lt;script>Foo&lt;/script>"

html.neuterJavaScript ("<hr onmouseover='window.alert (\"Message\")'>") //event handlers are removed

   » "<hr>"

html.neuterJavaScript ("<a href=\"javascript:window.alert ('Message')\">Foo") //non-legal schemes cause the opening left caret to get neutered

   » "&lt;a href=\"javascript:window.alert ('Message')\">Foo<a>"

Notes The default list of protocol schemes is fairly comprehensive, including the basics such as http, ftp, and mailto, but also including schemes such as x-netphone, pnm, and so on. See the script for the complete list.

When a URL does not contain a scheme, it's passed through un-neutered.

This verb, new in Frontier 7, is implemented as a script.

See Also html.neuterMacros

html.neuterTags

Discuss