Click or drag to resize

HelperEscapeInlineScript Method

Make a JavaScript source safe to embed in an inline <script> block of a self-contained HTML result: the closing tag sequences it may contain in string literals (e.g. '</body>' in the ECharts 'save as image' code) are escaped as '<\/...', which is identical for the JavaScript engine but no longer looks like HTML markup. Without this, the browser closes the script at a '</script' sequence, and HTML post-processors that inject markup before '</body>' (Visual Studio Browser Link and browser refresh, Application Insights or proxy script injection) cut the library in the middle, leaving its global (e.g. 'echarts') undefined in the exported result.

Namespace: Seal.Helpers
Assembly: SealLibrary (in SealLibrary.dll) Version: 10.2.0.0+da7797057e6d5ef3b02633ee3e36991921c726cb
Syntax
C#
public static string EscapeInlineScript(
	string script
)

Parameters

script  String
 

Return Value

String
See Also