I got the “url.indexOf
and e.indexOf
is not a function” errors on my website. I got this error after my upgrade to my Magento webshop, but this error can happen on any website with a jQuery version upgrade.
Error:
Uncaught TypeError: e.indexOf is not a function
at w.fn.load (jquery-3.3.1.min.js:2:82468)
at caribbean-montego-mntgo-shell:1483:19
at Object.execCb (require.js:1696:33)
at Module.check (require.js:883:51)
at Module.<anonymous> (require.js:1139:34)
at require.js:134:23
at require.js:1189:21
at each (require.js:59:31)
at Module.emit (require.js:1188:17)
at Module.check (require.js:938:30)
Uncaught TypeError: url.indexOf is not a function
at jQuery.fn.load (jquery.js:10363:23)
at (index):1166:19
at Object.execCb (require.js:1696:33)
at Module.check (require.js:883:51)
at Module.<anonymous> (require.js:1139:34)
at require.js:134:23
at require.js:1189:21
at each (require.js:59:31)
at Module.emit (require.js:1188:17)
at Module.check (require.js:938:30)
Cause:
Here’s the jQuery version 3 release note: https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/
Removed deprecated event aliases (https://github.com/jquery/jquery/issues/2286)
–
.load
,.unload
, and.error
, deprecated since jQuery 1.8, are no more.
– Use.on()
to register listeners.
Solution:
Search your custom/third-party modules code and replace the following deprecated excerpt:
$(window).load(function(){...});
with the following:
$(window).on('load', function(){ ...});
Hope this helps. Thanks.