Trouble inserting Javascript content in Webhelp Responsive Output
Posted: Thu Sep 06, 2018 6:10 pm
Hello,
I have trouble inserting a Javascript in my webhelp responsive output. I hope I could get some advice in this forum.
I need to insert a Javascript in the head element of the html pages of my webhelp responsive output. Here is the script:
This script was created because the webhelp documentation of our company website is contained inside an iframe element, and the script allows to keep the frame when opening a page of the documentation in a new tab/window.
I already have an XML file with an HTML fragment referenced in the webhelp.fragment.head parameter of the transformation scenario (it inserts a link at the top of my pages to come back to the welcome page of the support).
I tried to add the script in this same file, in the body element (also tried in head), according to guidelines in this topic: https://www.oxygenxml.com/doc/versions/ ... ransformat)
So it looks like this:
However, it does not seem to work. So I am afraid I did something wrong. I cannot identify if it comes from the HTML fragment itself or from the script. The script does work when manually put in an html topic (for test). Could anyone give me a hand if the issue comes from the fragment?
Thank you,
Julie
I have trouble inserting a Javascript in my webhelp responsive output. I hope I could get some advice in this forum.
I need to insert a Javascript in the head element of the html pages of my webhelp responsive output. Here is the script:
Code: Select all
<script>if (top.location == self.location) {
top.location = '${oxygen-webhelp-output-dir}/../../documentation.html?' + location.href;
}</script>
I already have an XML file with an HTML fragment referenced in the webhelp.fragment.head parameter of the transformation scenario (it inserts a link at the top of my pages to come back to the welcome page of the support).
I tried to add the script in this same file, in the body element (also tried in head), according to guidelines in this topic: https://www.oxygenxml.com/doc/versions/ ... ransformat)
So it looks like this:
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml">
<head xml:lang="en">
<title dir="ltr" lang="en">Back home page</title>
</head>
<body>
<script type="text/javascript">
<!-- if (top.location == self.location) {
top.location = '${oxygen-webhelp-output-dir}/../../documentation.html?' + location.href;
}
-->
</script>
<div class="top_link" style="font-size: 1.1em; color: white; font-family: Roboto;">
<div class="top_link_contents"><a href="${oxygen-webhelp-output-dir}/../index.html"><img src="${oxygen-webhelp-output-dir}/img-fragments/HomePage.png" alt="" width="20"/>
Back to support page</a>
</div> </div>
</body>
</html>
Thank you,
Julie