I know this is an old question that I came across. In any case, my answer may help another when the same problem arises. Unfortunately, I have no reputation to comment on Trott's answer above.
At the same time, if you use jQuery 1.8 or any $(window).on('load', function() {... });
version after it, then use $(window).on('load', function() {... });
, $(window).load()
deprecated in jQuery version 1.8 and there will be a jquery url.indexOf is not a function
error. jquery url.indexOf is not a function
(at least in jQuery 3.4.1)
source share