Aspose::Words::Saving::HtmlFixedSaveOptions::get_RemoveJavaScriptFromLinks method
Contents
[
Hide
]HtmlFixedSaveOptions::get_RemoveJavaScriptFromLinks method
Specifies whether JavaScript will be removed from links. Default is false.
_Bool Aspose::Words::Saving::HtmlFixedSaveOptions::get_RemoveJavaScriptFromLinks() const
Remarks
If this option is enabled, all links containing JavaScript (e.g., links with “javascript:” in the href attribute) will be replaced with “javascript:void(0)”. This can help prevent potential security risks, such as XSS attacks.
Examples
Shows how to remove JavaScript from the links for html fixed documents.
auto doc = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"JavaScript in HREF.docx"));
auto saveOptions = System::MakeObject<Aspose::Words::Saving::HtmlFixedSaveOptions>();
saveOptions->set_RemoveJavaScriptFromLinks(true);
doc->Save(get_ArtifactsDir() + u"HtmlFixedSaveOptions.RemoveJavaScriptFromLinks.html", saveOptions);
Shows how to remove JavaScript from the links.
auto doc = System::MakeObject<Aspose::Words::Document>(System::String(get_MyDir() + u"JavaScript in HREF.docx"));
auto saveOptions = System::MakeObject<Aspose::Words::Saving::HtmlSaveOptions>();
saveOptions->set_RemoveJavaScriptFromLinks(true);
doc->Save(get_ArtifactsDir() + u"HtmlSaveOptions.RemoveJavaScriptFromLinks.html", saveOptions);
See Also
- Class HtmlFixedSaveOptions
- Namespace Aspose::Words::Saving
- Library Aspose.Words for C++