I am including jQuery in background_page like this,
<script type="text/javascript" src="libs/jquery.js"></script>
Here’s the problem:
In websites, where jQuery plugins are used (with jQuery.extend method), they do not work when my extension is installed.
I guess this is because I had my jQuery.js over ‘their’ jQuery.js’ file and all .extend do not work.
So, I thought of adding jQuery.js only when its not avaialable. So, I tried adding jQuery like this,
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "libs/jquery.js";
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>
But no luck.
Can someone suggest me a good way to add jQuery.js file in background page.
Found an answer later,
Doing
jQuery.nocConflict
jQ = jQuery.noConflict
and replacing
$withjQeverywhere, solved the problem.Conclusion:
content_scriptscan also interfere with webpage javascripts.