JavaScript files only load upon refresh in SharePoint
- January 6, 2023
- 6 replies
- 1196 views
Good Day All:
I have an unresolved issue with JavaScript and Sharepoint ASPX files. This doesn't seem to be a problem with HTML files, only with ASPX files. There are two topics that have custom JavaScript files.
- Script A supports a horizontal tab menu on one topic.
- Script B supports a vertical tab menu on another topic.
The problem appears with both topics. When a topic loads in SharePoint, the script does not run. The script will run after a page refresh. However, the refresh doesn't "stick" when moving to another topic. For example:
- Select the first topic, the script doesnt run.
- Refresh the page, the script runs.
- Select the second topic, the script doesnt run.
- Refrush the page, the script runs.
- Return to the first topic, the script doesnt run.
RoboHelp 2020.5.71 is the authoring tool. The JavaScript code was moved to multiple locations (external file, within the header, within the body) to determine if that was the issue, but the results are the same. As you can see by the screen shot, I added a refresh button to the topic so the users can select it to activate the script, but this is just a band-aid.

In the example above: select the Code menu on the left and the script does not run.

In the example above, refresh the page, then select the Code menu, and the script runs.
I've worked with our SharePoint team and they are unable to identify the issue on their end. We've tried to resolve this issue since September but cannot find a resolution.
Looking forward to any assitance,
Ken
