I've tried inserting the code in the masterpage but still the code won't execute when clikcing between topics. Any ideas?
Which version of Robohelp are you using? If 2019, include whether you're using Classic or New UI. Also, which output and skin are you generating?
So sorry... I'm using 2020.7.46 with the skin "Orange" as base.
So I've tried adding a simple script in one of the topic like so:
Now the log script will fire when reloading the page but when going from another topic page to this the script won't fire.
If you added the script to only a single topic, then it will only run when you navigate to that topic.
I created a test project with Topic A and Topic B. I added the script in Topic A, but just above the closing body tag, because I don't think it would work at all after the html tag.
As expected, the script runs when I navigate to Topic A. Also as expected, when I navigate to Topic B, the script doesn't run because it isn't in Topic B. When I navigate back to Topic A, the script runs.
If you want the script in multiple topics, I would recommend including the script in a master page. You can then either assign the master page to each topic you want the script in, or assign it in your output preset and the script will be included in all topics.
Yes of course, the script would only be run on the specific topic. Either way, it doesn't matter where the script is added, in the masterpage or specific topic, the script will only run when the page is loading which would be once, not when navigating between topics.
Please take a look att my recording of the behavior below.
So in my video it shows that the log script only fires when I load the page, not when navigating to the topic. If it did it would be multiple of console logs in the console window.
To be clear, the script fires correctly when I'm locally testing with the "view output", this is because the whole project is reloaded when navigating between topics locally. It's when the project is published and on a server that the scripts stops working becasue the whole site is only loaded once you first visit, when navigating topics there's no page load once on the server.
No, I've not been able to resolve this unfortunately.
So I think my issue is resolved. I switched my skin from Frameless to HTML5 and it seems to work. I am going to do a bit more testing, but I believe that was the trick for me.
It would be worth logging a bug report, I think. It seems like most development is being done in the Frameless skins, rather than Responsive, and they do offer more customisation options. You can request features and report issues here: https://tracker.adobe.com/
Post the item number in the discussion so people can easily vote if they want the same functionality.
I am not sure if he created the bug but I went ahead and did so as I am facing the same issue. This is not on a SharePoint deployment. I have a chat widget for one page, and a highlight script applied to all pages. Nothing I have tried can get the scripts to fire upon initial load when navigating from the frameless toc. Only after i refresh the page does it load.
Ticket Link - https://tracker.adobe.com/#/view/RH-11720
We are experiencing a similar issue.
I believe this problem is caused by the React engine, which only loads once when the page is initially loaded. When switching between topics, the React app doesn't re-run, resulting in no changes being applied to the other topics.