/    Sign up×
Community /Pin to ProfileBookmark

Firefox versus Chrome

Hello everyone!
I’ve been facing a problem with jQuery script while running an userscript in Chrome. It works with Greasemonkey in Firefox, but it doesn’t work in Chrome.

I tried running a simple javascript and it worked, but when I try to do something with jQuery it doesn’t work.

Is there a posibility that Chrome does not support jQuery? ?

Also, if it can help, here that script:

[CODE]var $;

// Add jQuery
(function(){
if (typeof unsafeWindow.jQuery == ‘undefined’) {
var GM_Head = document.getElementsByTagName(‘head’)[0] || document.documentElement,
GM_JQ = document.createElement(‘script’);

GM_JQ.src = ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js’;
GM_JQ.type = ‘text/javascript’;
GM_JQ.async = true;
GM_Head.insertBefore(GM_JQ, GM_Head.firstChild);
}
GM_wait();
})();

// Check if jQuery’s loaded
function GM_wait() {
if (typeof unsafeWindow.jQuery == ‘undefined’) {
window.setTimeout(GM_wait, 100);
} else {
$ = unsafeWindow.jQuery.noConflict(true);
}
}

var twitterdel = $(‘li.twitter’);
$(twitterdel).remove();
var fbdel = $(‘li.facebook’);
$(fbdel).remove();
var bannerdel = $(‘div.banner’);
$(bannerdel).remove();
[/CODE]

Note that I had to add that code above

[CODE]var twitterdel = $(‘li.twitter’);[/CODE]

because it didn’t show up in firefox too. When I delete that part, the whole script doesn’t work anymore.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @milos95zr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...