jquery 3.0 url.indexOf error
Jquery 3.0 has some breaking changes that remove certain methods due to conflicts. Your error is most likely due to one of these changes such as the removal of the .load() event.
Read more in the jQuery Core 3.0 Upgrade Guide
To fix this you either need to rewrite the code to be compatible with Jquery 3.0 or else you can use the JQuery Migrate plugin which restores the deprecated and/or removed APIs and behaviours.
Better approach may be a polyfill like this
jQuery.fn.load = function(callback){ $(window).on("load", callback) };
With this you can leave the legacy code untouched. If you use webpack be sure to use script-loader.
I came across the same error after updating to the latest version of JQuery. Therefore I updated the jquery file I was working on, as stated in a previous answer, so it said .on("load")
instead of .load()
.
This fix isn't very stable and sometimes it didn't work for me. Therefore to fix this issue you should update your code from:
.load();
to
.trigger("load");
I got this fix from the following source: https://github.com/stevenwanderski/bxslider-4/pull/1024
Update all your code that calls load
function like,
$(window).load(function() { ... });
To
$(window).on('load', function() { ... });
jquery.js:9612 Uncaught TypeError: url.indexOf is not a function
This error message comes from jQuery.fn.load
function.
I've come across the same issue on my application. After some digging, I found this statement in jQuery blog,
.load, .unload, and .error, deprecated since jQuery 1.8, are no more. Use .on() to register listeners.
I simply just change how my jQuery objects call the load
function like above. And everything works as expected.