I have a chrome extension which is using jQuery as content script with noconflict like;
var myDomainJquery = $.noConflict(true);
on the other hand some websites are also using jQuery noconflict on their way like; for example new york times
<script>var jQ = jQuery.noConflict(true);</script>
Then I am getting Cannot read property 'noConflict' of undefined error on the host website.
Is there any way to fix this problem?
I have a chrome extension which is using jQuery as content script with noconflict like;
var myDomainJquery = $.noConflict(true);
on the other hand some websites are also using jQuery noconflict on their way like; for example new york times
<script>var jQ = jQuery.noConflict(true);</script>
Then I am getting Cannot read property 'noConflict' of undefined error on the host website.
Is there any way to fix this problem?
Share Improve this question asked Jun 5, 2014 at 16:28 Teoman shipahiTeoman shipahi 23.2k16 gold badges144 silver badges173 bronze badges 01 Answer
Reset to default 4Yes, there is. The way to fix it is to understand the isolated context content scripts run in.
A content script has no access to any JS loaded by the page itself; if you need jQuery, you need to package it with your extension and inject it yourself first. On the bright side, there can be no conflict with the page, and you can simply use $
.