I had an issue after inserting a script for the Google Tag Manager into <head> the section of my online docs.
Everything worked fine when the docs where online. But, whenever I opened one of the pages locally on my computer, it would load the main frame and then pause for about 20 seconds before loading the TOC.
The solution was to add some code to the script to determine if it is online (HTTP) or running from a local file.