ignore_noscript_elements property

HtmlLoadOptions.ignore_noscript_elements property

Gets or sets a value indicating whether to ignore <noscript> HTML elements. Default value is False.

@property
def ignore_noscript_elements(self) -> bool:
    ...

@ignore_noscript_elements.setter
def ignore_noscript_elements(self, value: bool):
    ...

Remarks

Like MS Word, Aspose.Words does not support scripts and by default loads content of <noscript> elements into the resulting document. In most browsers, however, scripts are supported and content from <noscript> is not visible. Setting this property to True forces Aspose.Words to ignore all <noscript> elements and helps to produce documents that look closer to what is seen in browsers.

Examples

Shows how to ignore <noscript> HTML elements.

html = '\n                    <html>\n                      <head>\n                        <title>NOSCRIPT</title>\n                          <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">\n                          <script type=""text/javascript"">\n                            alert(""Hello, world!"")\n                          </script>\n                      </head>\n                    <body>\n                      <noscript><p>Your browser does not support JavaScript!</p></noscript>\n                    </body>\n                    </html>'
html_load_options = aw.loading.HtmlLoadOptions()
html_load_options.ignore_noscript_elements = ignore_noscript_elements
doc = aw.Document(io.BytesIO(html.encode('utf-8')), html_load_options)
doc.save(ARTIFACTS_DIR + 'HtmlLoadOptions.ignore_noscript_elements.pdf')

See Also