Golang text/template.JSEscaper() function example
package text/template
Golang text/template.JSEscaper() function usage example.
package main
import (
"fmt"
"text/template"
)
func main() {
a := "<script>alert('xss!')</script>"
b := "<script>alert('javascript')</script>"
final := template.HTMLEscaper(a, b)
fmt.Println(final)
}
Output :
<script>alert('xss!')</script><script>alert('javascript')</script>
Reference :
Advertisement
Something interesting
Tutorials
+4.8k Golang : A program that contain another program and executes it during run-time
+7.9k Javascript : Put image into Chrome browser's console
+16.3k Golang : Find out mime type from bytes in buffer
+12.1k Golang : Sort and reverse sort a slice of runes
+26.8k Golang : Find files by extension
+22.9k Golang : Calculate time different
+20.2k Golang : Compare floating-point numbers
+5.3k Golang : Pad file extension automagically
+28.7k Golang : Detect (OS) Operating System
+9.8k Golang : Resumable upload to Google Drive(RESTful) example
+9.6k Golang : How to generate Code 39 barcode?
+9.5k Golang : Accessing content anonymously with Tor