Javascript does not function properly under certain circumstances


We've got a website(with HTTPS) with jQuery and Javascript. We noticed that under some circumstances the Javascript simply won't load. In console, it simply prints out some JS error(undefined) but I can't tell it's because the js file is not getting included or there is some syntax error somewhere.

It happens when I use some Guest internets(Tried the guest Wifi in stanford university & emory university). And sometimes it just happens even I'm in the office, and it will be fine again in like 10 minutes. It only happens to some computers as well in the office(All MAC OSX w/ safari) and some of them are fine. To be it's like totally random unless I'm under some guest wifi.

What could be the reasons?

Best, Jack

Edit: Someone feels like it's too board, sorry for the issue but I'm doing my best to describe the problem. This happens in a random manner and it won't get fixed by refreshing the page when it happens. And all the javascript files are included in a https way.

Edit: I noticed that on some circumstances, I have functions defined after the place they are called. Could this be the reason?

You need to use a Jquery CDN that supports https, or put the code on your own site/server and include it from your domain. Here are two examples which will work over ssl.

<script type="text/javascript"

I generally trust google libraries as a cdn, its up to you.

<script type="text/javascript"

If you don't want to trust google you can deploy it on your own.