Disable context menu in browser
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 37
- Joined: Tue Apr 13, 2021 9:48 pm
Disable context menu in browser
Post by Jeff_Reynolds »
I want to secure the content in WebHelp by disabling Save as...
I think the HTML is
What has to happen in XML source, can I set an xform attribute?
I think the HTML is
Code: Select all
<html>
<body oncontextmenu="return false;">
</body>
</html>
-
- Posts: 38
- Joined: Fri Jan 22, 2021 11:05 am
Re: Disable context menu in browser
Post by beniamin_savu »
Hi,
There are 2 possible solutions to add the oncontextmenu attribute on the <body> element.
1. Adding the attribute using XSLT extension point:
* Create a custom publishing template
* In the custom publishing template folder create a folder named xsl
* In the xsl folder create a xsl file, for example disable-context-menu.xsl.
* Add in the xsl file the following template:
* Open the template descriptor file associated with your publishing template (the .opt file) and set the XSLT stylesheet created in the previous step with the com.oxygenxml.webhelp.xsl.createMainPage XSLT extension point.
* Run the WebHelp Responsive transformation using the custom publishing template.
Note: An example for this publishing template can be found here using the following link https://github.com/oxygenxml/oxygen-pub ... ntext-menu
2. Adding the attribute by modifying the HTML Page Layout Files:
* Create a custom publishing template and select the Include HTML Page Layout Files.
* In your custom publishing template edit the page-templates/wt_topic.html file and add the attribute oncontextmenu on the <body> element.
* Run the WebHelp Responsive transformation using the custom publishing template.
Best regards,
Beniamin Savu
Oxygen WebHelp Team
http://www.oxygenxml.com
There are 2 possible solutions to add the oncontextmenu attribute on the <body> element.
1. Adding the attribute using XSLT extension point:
* Create a custom publishing template
* In the custom publishing template folder create a folder named xsl
* In the xsl folder create a xsl file, for example disable-context-menu.xsl.
* Add in the xsl file the following template:
Code: Select all
<xsl:template match="*:body[contains(@class, 'wh_topic_page')]" mode="copy_template">
<xsl:copy copy-namespaces="no">
<xsl:attribute name="oncontextmenu">return false;</xsl:attribute>
<!-- Apply the default processing -->
<xsl:next-match/>
</xsl:copy>
</xsl:template>
Code: Select all
<publishing-template>
...
<webhelp>
...
<xslt>
<extension
file="xslt/disable-context-menu.xsl"
id="com.oxygenxml.webhelp.xsl.dita2webhelp"/>
</xslt>
...
</webhelp>
</publishing-template>
Note: An example for this publishing template can be found here using the following link https://github.com/oxygenxml/oxygen-pub ... ntext-menu
2. Adding the attribute by modifying the HTML Page Layout Files:
* Create a custom publishing template and select the Include HTML Page Layout Files.
* In your custom publishing template edit the page-templates/wt_topic.html file and add the attribute oncontextmenu on the <body> element.
Code: Select all
<body class="wh_topic_page" oncontextmenu="return flase;">
Best regards,
Beniamin Savu
Oxygen WebHelp Team
http://www.oxygenxml.com
-
- Posts: 37
- Joined: Tue Apr 13, 2021 9:48 pm
Re: Disable context menu in browser
Post by Jeff_Reynolds »
Thanks for the solution, much appreciated
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service