With no recent changes to my site, when clicking (or rolling over) the ShareThis icon, javascript errors occur instead of the ShareThis popup appearing. This happens in IE 7 on PC, FF 3.5.4 on PC and Mac and on Safari 4 mac. No differences seem to be made when clearing the cache and inserting the updated button embed code to override the module's.
I tried using the updated code straight from ShareThis.com, but that didn't seem to make a difference either...
Browser/OS(s): Firefox 3.5 (PC & Mac) (w/ updated button code)
Version: Both 6.x-1.x-dev and 6.x-1.6
(when hovering over the button)
shareel is null
Source File: http://w.sharethis.com/button/sharethis.js#publisher=3e6e5018-fef0-4237-b17c-595a95e93007&type=website&button=false
Line: 1
(when clicking on the button -- errors seems to repeat continuously until page refresh)
Error: uncaught exception: [Exception... "Unexpected error arg 0 [nsIDOMWindowInternal.location]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: http://w.sharethis.com/button/sharethis.js#publisher=3e6e5018-fef0-4237-b17c-595a95e93007&type=website&button=false :: anonymous :: line 1" data: no]
Browser: IE - (w/ and without updated button code on both versions of ShareThis module)
Line: 2, Char: 10750, Error: Object Required, Code: 0
Inconsistently, I get this error, too, in FF:
Error: $try is not defined
Source File: http://w.sharethis.com/share3x/js/mootools-1.2.1-core-nc.js
Line: 1
| Comment | File | Size | Author |
|---|---|---|---|
| #74 | shareel_is_null-619964-74.patch | 565 bytes | altrugon |
| #66 | Picture 1.png | 72.33 KB | Mac Clemmens |
| #50 | grrrrr.patch | 9.34 KB | robloach |
| #30 | jquery.sharethis.js_.patch | 957 bytes | arcaneadam |
| #25 | jquery.sharethis.js_.patch | 1.06 KB | shawngo |
Comments
Comment #1
pcorbett commentedThe Safari js error appears as:
Comment #2
lucidus_neil commentedWe are experiencing the exact same thing.
Comment #3
asghar commentedHello
I also facing this problem in fire fox how we can solve this problem?
Comment #4
JacobSingh commentedI can confirm this.
Busted for me too.
Comment #5
Thet commentedsame here.. no solution yet??
Comment #6
Thet commentedgoing back to 1.3-3 seems to be working again.
Comment #7
ChrisRut commentedSame here...
:subscribe:
Comment #8
joshfromdallas commentedSame Problem,
How do you get 1.3-3 working again? Can someone provide the steps?
Comment #9
otmg commentedsame exact problem. suddenly stopped working.
Comment #10
dvness commentedI am having the same error occur on two drupal sites that use the sharethis javascript code:
- One site is running on 6.12
- The other site is running on 6.14
Comment #11
tnightingale commentedI too am having this error - subscribing
Comment #12
pcorbett commentedComment #13
manoz_79 commentedI too am having this error - subscribing
Comment #14
awasson commentedYup... Same problem here.
In the interim, I'm just putting the Sharethis code in a block and placing it where I need it.
Comment #15
Anonymous (not verified) commentedSubscribing
Comment #16
glacialheart commentedSame thing for me. Subscribing.
Comment #17
geocalleo commentedIs this happening to everyone across the board? Using the latest sharethis module? Also, where can I find a previous version so I can downgrade to it?
Comment #18
anonThe problem seems to be that we are missing a wrapping span with an id attribute equals to "sharethis_X" around the link
Example:
<span id="sharethis_0">linkhere</span>This patch is tested in
FF 3.5.7
IE 7
IE 8
Chrome 3.0.195.38
Comment #19
robloachCommitted! Wow, that was fun. http://drupal.org/cvs?commit=319890
I'll make a release off of this, close the other issues. This queue is way out of hand and obsolete.
Comment #20
devkinetic commentedI'm still having issues with this after the update, and can confirm that the
<span>is there. I created a ticket here filed under the 1.7 release.http://drupal.org/node/696128
Comment #21
kim.pepperStill getting this after updating to 1.7. Chrome reports: "Uncaught TypeError: Cannot read property 'offsetParent' of null"
The only reference to this in share.js is if(shareel.offsetParent){...
I think shareel is not being found, but its incredibly difficult to debug it as its been minified.
Kim
Comment #22
anonHmm, Looks like I just had some luckytime with my patch.
The problem is that the
named "stiframe" isnt included all the time. I having a hard time to find out why.Comment #23
Mac Clemmens commented[Break on this error] (no source for )
uncaught exception: [Exception... "Unexpected error arg 0 [nsIDOMWindowInternal.location]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: http://w.sharethis.com/button/sharethis.js#ref=jquery&button=false :: anonymous :: line 1" data: no]
I'm getting this error over and over in firebug.
Comment #24
yadranko commentedSame problem here, 6.x-1.6 & 6.x-1.7 both don't work for me.
Comment #25
shawngo commentedI'm getting results where a page with only one ShareThis instance starts at id="sharethis_1" but jquery.sharethis.js is starting at "sharethis_0".
I have a production and stage version of this running - production works but requires patching sharethis/sharethis/jquery.sharethis.js (1.7), stage works just fine.
This patch is just an example of what I had to do to resolve (temporarily).
Comment #26
devkinetic commentedinteresting that your stage and prod work differently. Is your stage a carbon copy of prod? or is a dev/stage server?
I'd venture to wonder if your module's javascript files are being called in an order that allows it to work on stage, and in a different order on prod.
Comment #27
marcvangendSubscribe. I'm seeing the same bug with the 'shareel is null' error, in both 1.7 and the dev version. I tried the patch in #25 on both versions, but it didn't work for me.
Sometimes when loading the page with the dev version I get two identical errors like this:
Then, when I hover over the ShareThis icon, the scripts start returning this error indefinitely (within seconds, the firebug console shows a few hundred errors and there is no way to stop it other than refreshing the page):
Comment #28
shawngo commentedThe fact that this did not work in my production environment should have been a big fat red flag. The only difference between the two is the production site has Google Analytics enabled.
What I found was that for some reason everything ShareThis related fails if there are any script blocks outside the head tag (in Firefox (tested ver3.6)).
What I did was, in the Google Analytics settings, selected "Header" in the JAVASCRIPT SCOPE under the ADVANCED OPTIONS.
This still didn't fix the issue since Google Analytics module implements googleanalytics_footer to add any other tracking code.
Here are my updates (sorry no patch) to google_analytics/googleanalytics.module lines 81-94:
I renamed the hook_footer implementation to googleanalytics_header and called googleanalytics_header from the above googleanalytics_init function.
This is possibly the worst solution and I don't recommend. It is only for.. educational porpoises.
Any ideas on how to overcome this issue? I thought I found a similar reference in the forums between ShareThis and GoogleAnalytics.
Shawn
Comment #29
devkinetic commentedGreat you got it working and thanks for finding that bug.
Obviously, this is not a solution. Plenty of other modules / javascript require script blocks outside of the head. The question is what has changed to the module to instigate this conflict. My gut is telling me its the way/order in which the sharethis javascript is being implemented on the page.
Comment #30
arcaneadam commentedThe patch below works, though you may need to change the paths declared in the patch as they were made from my cvs folder.
The problem with the javascript is that it should be adding a span with an id of sharethis_# to all sharethis links. The span id numbers should start at 1 and go up from there. The jquery code that is written loops through the elements but in a loop the i var starts at 0. Simply doing a var a = i + 1; and then using the a var in the id fixes the problem easily.
The attached patch adds that code
Comment #31
sh264 commentedre:#30
confirming the changes in arcaneadam's patch will work without needing to touch googleanalytics.module
solved for me accross 3 production sites; browsers: ff3.5, ie7/8, chrome (safari); modules: sharethis 6.x-1.7, googleanalytics 6.x-2.2
i like the educational porpoises, wise creatures of the sea.
Comment #32
catch#30 works for me.
Comment #33
robloachCommitted! Thanks for taking a look at this one.
Comment #34
sh264 commentedawesome. thanks Rob.
Comment #35
AlexisWilke commentedRob,
You may want to create a version 1.8 since, in effect, 1.7 does not work... I just spent 30 min. trying and all I should have done is take the -dev version!?
And yes, that fix took care of the problem. 8-)
Thank you.
Alexis
Comment #36
robloachSounds good! :-) ... Thanks a lot for all the tests.
Comment #37
gilgabar commentedPerhaps there are multiple issues here, but I'm using 1.8 and still getting the error described in the original post: "TypeError: Result of expression 'shareel' [null] is not an object." in Safari and "shareel is null" in Firebug.
Comment #38
AlexisWilke commentedgilgabar,
Did you make sure you cleared your server & FF caches? (the server cache, especially if you have boost!)
Thank you.
Alexis
Comment #39
gilgabar commentedYes, cleared caches, but this was a brand new install of the sharethis module anyway, so there should not have been anything to clear.
Comment #40
AlexisWilke commentedgilgabar,
Ah! Good point. If it was a new install, it should work as is.
Thinking of it, I used my own code (thinking that maybe the default code could be the culprit.) Could you try with new code from ShareThis to see whether that works?
Thank you.
Alexis
Comment #41
rkdesantos commentedThe new code fails on at least of my Drupal sites. Even after clearing the cache, etc, the button disappears on the links line, errors in JS, and the settings screen fails to display my customized code for reasons I didn't determine (may be related to FCKeditor showing up rather than just a text box -- however the code still wasn't there if I went to text mode). Have reverted to 1.3.3 again and all is well. Something is still amiss in the JS.
Comment #42
joshfromdallas commentedStill doesn't work for me either. I removed the module and uploaded the latest release and still doesn't work. How did you get 1.1.3 to work.
Comment #43
joshfromdallas commentedI copied the code from the sharethis site and inserted to test and it works, so looks like something else is going on. Even if I try to download 1.33 or whatever it still doesn't work
How did you guys get the old version to work?
Comment #44
rkdesantos commented@joshfromdallas: make sure you have completely removed and uninstalled the 1.8 version and then upload 1.3.3. (not 1.1!) Clear caches. Obviously any unrelated issues "fixed" since 1.3.3 will return.
Comment #45
jm.federico commentedOk, for ver 1.8 you have to undo patch in #30, which was commited, but guess what, broke everything. So go to jquery.sharethis.js and remove
var a = i + 1;
and change
var wrapper = jQuery('').attr('id', 'sharethis_'+a);
to
var wrapper = jQuery('').attr('id', 'sharethis_'+i);
Federico
Comment #46
robloachThis is how development here works:
If you're not happy with things that are being committed, then please submit a new patch instead of complaining about what is going in. Thanks.
Comment #47
rkdesantos commented@Rob Loach: just who is complaining? Saying something broke isn't a complaint against anyone. It's just describing what happened in that users situation. We're all just trying to exchange information and figure out what works and where the problem(s) are. I imagine that once that happens, someone may step forward with a patch. Until then, we're just trying to deal with a less than perfect situation.
Comment #48
AlexisWilke commentedjm.federico,
The old code did not work for me and many others. I'm not too sure why the new code does not work for you, but 1.7 was useless on my end... Did 1.7 work for you as is?
Thank you.
Alexis
Comment #49
robloach@rkdesantos Sorry, I was under the impression people were just complaining about things being committed to the module along with noone helping out with a patch. A misconception on my part. Thanks for the explanation.
Comment #50
robloachLess features because it moves back to the straight code that ShareThis gives you.
Comment #51
jm.federico commentedAlexisWilke
I never tried 1/7, first time I used this modules was with 1.8
Out of the box it didn't work, I then went through the code and saw that the patch in 30 was casing the problem. Right now can't give you much more info except that once I made the change I mention in 45, things worked.
It seems like the only difference between 1.8 and 1.7 is that patch which then confuses me, because it was the patch what was casing me issues.
I can't provide much more info cause I'm not using the module anymore, had some display issued caused by ShareThis itself and not this Drupal module, which made me stop using it.
Hope this helps.
Comment #52
serbanghita commented@jm.federico is kinda right.
I made a checkout of the last version of ShareThis module from the CVS, i went to
/sites/all/modules/sharethis/sharethis/jquery.sharethis.jsand changed the line:var wrapper = jQuery('<span></span>').attr('id', 'sharethis_'+a);intovar wrapper = jQuery('<span></span>').attr('id', 'sharethis_'+i);But only works in Firefox.
Then i have downloaded
http://ftp.drupal.org/files/projects/sharethis-6.x-1.7.tar.gzand kept the above change to/sites/all/modules/sharethis/sharethis/jquery.sharethis.jsand worked in all browsers!Comment #53
BrockBoland commentedI have a View listing the teaser for several blog posts, with a ShareThis link next to each one. Right now, I'm doing all my testing on a Mac - haven't fired up the virtual machine to try this in Windows yet.
In Firefox, 1.8 and the current -dev both fail on the first item in the list, but work on the others. If I revert the change to the ID on that span - as serbanghita describes in #52 - then that bug goes away. This bug was also affecting the node view; since there is only one ShareThis link when viewing a node, then the first ShareThis link wasn't working, it would not work on that page. It only worked on ShareThis links that were NOT the first on the page.
However, that doesn't solve the problem completely. After making that change, it works every time in Firefox, but in Safari and Chrome, it's hit and miss: sometimes every ShareThis link works, sometimes none do. I've been checking the links, doing a hard refresh, checking again, and so on, and it seems to fail about 2 times out of 3.
This leads me to suspect a race condition. It seems like the JS is trying to assign that functionality to the links before the ShareThis code is pulled in from their server - though if I understand the code correctly, that's what the
sharethisQueuevariable is there to handle (right?).Anyway, I haven't had any luck yet, but I hope this helps move someone a step forward.
Comment #54
AlexisWilke commentedHi Brock,
I have a link near the bottom of this page:
http://linux.m2osw.com/drupal
Is it working for you, or not? (the page may be loading a little slow as it is on my DSL)
It works great for me in SeaMonkey & FireFox under Linux (I rarely use IE, only to test Customers websites...)
Thank you.
Alexis Wilke
Comment #55
BrockBoland commentedAlexis - looks good in Safari, Chrome, and FF Mac. I refreshed a couple times to be sure.
Comment #56
rkdesantos commentedSounds like v1.8 + #52 + solution to the possible race condition described in #53 and we are almost there.
Comment #57
BrockBoland commented#52 actually rolls back the one change from 1.7 to 1.8, so really:
1.7 + solution to the possible race condition described in #53
But, still haven't figured out whether it really is a race condition or not.
Comment #58
robloachIf someone either reviews that patch and sets the issue to RTBC, or uploads a new patch that gets RTBCed, I'd be more than happy to commit it.
Comment #59
AlexisWilke commentedWell... this is weird, isn't it?!
I'm running with 1.8 and it works just fine for BrockBoland off of my server. Yet, we are saying here that the problem is in the JavaScript and thus due to the client, not my server. And if version 1.8 is really the problem, then it should fail on his computer browser.
So a race condition possibly, or a conflict with another module!
I'll have a look to the JS again...
Thank you.
Alexis
Comment #60
AlexisWilke commentedCould that be it?
You include the JavaScript from sharethis.com after the Drupal module sharethis code. For those with a problem, could you try to move the first two drupal_add_js() calls after the if() block and report whether that helps at all?
Now... What is that 'true' in the following if() condition?! Is that some debug left over? Or is it because we want to create a new button for each teaser entry?
Thank you.
Alexis
Comment #61
psykomf commentedI am using 1.8 and I get the "Shareel is null" error on the first sharethis icon that shows on the page. All subsequent icon's work correctly with no error message.
The best fix for this seems to be uninstalling 1.8, installing 1.7 and going through step #53?
Comment #62
psykomf commentedI was actually able to get 1.8 working correctly by changing this line in jquery.sharethis.js
var a = i + 1;
to var a = i;
Comment #63
AlexisWilke commentedpsykomf,
Did you try what I suggest in #60 ?
Thank you.
Alexis
Comment #64
werushka commentedhi AlexisWilke I am also getting the same problem, from your #60 i tried your solution to move the drupal_add_js s after if but which one? I tried couple of variations but still couldn't figure out. Could you please point out?
Comment #65
AlexisWilke commentedWerushka,
I do not know whether that would work, but it seems to make sense that the Drupal JS should be included after the Share This JS. Now, looking at the code closer, it won't matter since Drupal will anyway include those JS in the header. We may need to add them to the footer instead or inline.
It would have been like this:
But we may actually need to also change the drupal_add_js() call like this:
In this case, they can appear before or after the if(), it shouldn't matter.
Btw, if it works as I'm thinking it should, then the fix in 1.8 should also be removed... (it seems to me). Thus, testing 1.7 and 1.8 with this fix, 1.8 shouldn't work.
Thank you.
Alexis
Comment #66
Mac Clemmens commentedHi Alexis,
I tried #65 and it didn't work.
Checking the firebug log, I get the following errors:
shareel is null
[Break on this error] ST_JSON=new function(){this.encode=fun...bj=SHARETHIS.addEntry()}}catch(err){};
sharet...n=false (line 1)
uncaught exception: [Exception... "Unexpected error arg 0 [nsIDOMWindowInternal.location]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: http://w.sharethis.com/button/sharethis.js#publisher=ae9b6ac6-092d-466c-... :: anonymous :: line 1" data: no]
When I move the script to the footer, I get a lot of errors. I've attached the error log from firebug.
I just wrote my own module to do it and I had no problems. I just basically plopped the sharethis code right into the link area. Is this simpler approach possible?
Comment #67
AlexisWilke commented@Digital Deployment,
Today I got a surprise! I was working on the ladybug theme, when I went to my Linux Geek page...
Somehow, the page would load, just fine, and then start running the JavaScript code loaded by AJAX by this module and kaboom! A nice WSOD. But for once, a JavaScript WSOD. The result with a completely empty page. I tried with Chrome and that worked. But SeaMonkey and FireFox both failed at that point.
The failure happens in the ShareThis code loaded by AJAX, but I'm not too sure why that would be.
Then I tried your solution with just putting a <script> tag and the necessary URL and it worked like a charm...
I'm not too sure where the problem lies. It could be too old a version of the sharethis/*.js library?
Thank you.
Alexis
Comment #68
scottsawyerThis worked great for me!! Thank you, thank you.
Tested FF 3.5, Chrome on Winders 7
Comment #69
tomotomo commentedFor those who are saying this is fixed, what browsers are you testing in? And do you have theme devel on?
Comment #70
dboulet commentedIn my case, 1.7 works fine, 1.8 does not. I was getting "Uncaught TypeError: Cannot read property 'offsetParent' of null" in Chrome with 1.8.
Comment #71
dafederSo, I finally got this working by downloading this latest dev version and applying the patch in #30 in REVERSE. I imagine this would work on 1.8 as well. DL the patch into your modules/sharethis folder, and do:
patch -p2 -R < jquery.sharethis.js__1.patch
Comment #72
kyoder commentedit appears that the patch from #30 has been applied which is great except it seems that now i needs to start at 0 and not at 1
so that part of the patch "a = i +1" breaks the current 6.x version of the module
so to fix simply set a = i
Comment #73
altrugon commentedI had to use #72 for version 6.x-1.8
Comment #74
altrugon commentedHere is a patch for comment #73:
Comment #75
avpadernoI am closing this issue, as Drupal 6 is no longer supported. Please re-open it if the issue is still relevant for the Drupal 7 or 8 version of the module.