I downloaded the new version of Thickbox version 6.x-1.3 and there is a Javascript error in the file thickbox.js at line 359 (which is in the function tb_setBrowserExtra) , its quite a simple fix though, there is an unneeded comma at the end of the line -> macfirefox: /mac/.test( userAgent ) && /firefox/.test( userAgent )
the funciton at the moment is :
function tb_setBrowserExtra() {
// Add iPhone, IE 6 and Mac Firefox browser detection.
// msie6 fixes the fact that IE 7 now reports itself as MSIE 6.0 compatible
var userAgent = navigator.userAgent.toLowerCase();
$.browserextra = {
iphone: /iphone/.test( userAgent ),
msie6: /msie/.test( userAgent ) && !/opera/.test( userAgent ) && /msie 6\.0/.test( userAgent ) && !/msie 7\.0/.test( userAgent ),
macfirefox: /mac/.test( userAgent ) && /firefox/.test( userAgent ), <<<<<<< note this comma shouldn't be here
};
}
so the fix is
function tb_setBrowserExtra() {
// Add iPhone, IE 6 and Mac Firefox browser detection.
// msie6 fixes the fact that IE 7 now reports itself as MSIE 6.0 compatible
var userAgent = navigator.userAgent.toLowerCase();
$.browserextra = {
iphone: /iphone/.test( userAgent ),
msie6: /msie/.test( userAgent ) && !/opera/.test( userAgent ) && /msie 6\.0/.test( userAgent ) && !/msie 7\.0/.test( userAgent ),
macfirefox: /mac/.test( userAgent ) && /firefox/.test( userAgent )
};
}
Comment | File | Size | Author |
---|---|---|---|
#25 | 463566-thickbox-browserextra.patch | 497 bytes | AaronBauman |
Comments
Comment #1
StevenPatzThis appears to be fixed in the dev version.
Comment #2
frjo CreditAttribution: frjo commentedAccording to another issue it only effects Internet Explorer so I have not noticed it myself.
Comment #3
ZeroIQ CreditAttribution: ZeroIQ commentedYes it does only seem to be Internet Explorer.
I have a Visual Basic application that uses IE to automatically add ubercart products via the Drupal interface and when a java script error occurs a message box appears which breaks the automation of the application.
The work around for my situation is to make another application to handle java script errors, which is something I really want to avoid.
I've fixed the java script error in my copy of the file, but if that error could be fixed in the main source file then I know I'll be able to update without having to edit the script again :-)
Comment #4
frjo CreditAttribution: frjo commentedA new official release, 6.x-1.4, now has this fix.
Comment #5
ZeroIQ CreditAttribution: ZeroIQ commentedcool thank you :-)
Comment #6
btopro CreditAttribution: btopro commentedI'm still getting an error with this where my stuff fails to work in FF 3 for Mac. It seems like the $.browserextra never gets created (comes up null if I alert it to the screen). And when line 43 runs -- if ($.browserextra.macfirefox) { it stops there and that variable's output doesn't do anything. Is there a certain version of jQuery needed to run this? I tried both jquery_update and without and it doesn't seem to work either way.
Comment #7
frjo CreditAttribution: frjo commentedHave you updated to 6.x-1.4 and cleared Firefox and Drupals cache?
"$.browserextra.macfirefox" returns TRUE in my FF 3 for Mac on my own blog.
Comment #8
criznach CreditAttribution: criznach commentedbtopro: How are you triggering thickbox?
I had a site that was bailing out at line 44 of thickbox.js 6.x-1.4 in FF 3.0.10 on Windows XP. .browserextra was undefined. I was calling tb_show in a function that was being called from a flash movie. In my case, after a few hours debugging, I discovered that when calling tb_show() yourself, you need to first call tb_setBrowserExtra().
This is the danger of an all-encompassing try{} with an empty catch() block... No errors get triggered for the entire try block.
Comment #9
btopro CreditAttribution: btopro commentedYa i'm caling tb_show on my own by binding it to clicks in my interface. so if I call tb_setBrowserExtra it'll be good to go?
Comment #10
frjo CreditAttribution: frjo commentedYes you should.
Any opinions on moving tb_setBrowserExtra() to the top of tb_show()?
Comment #11
criznach CreditAttribution: criznach commentedThat was my thought too. I don't have the code in front of me, but if it's not complicated, it wouldn't hurt to set the flags multiple times. Or better yet, simply return if it's already been set up.
Comment #12
p.brouwers CreditAttribution: p.brouwers commentedI agree, just move tb_setBrowserExtra() to the top of tb_show().
All it does is set some global variables, which doesn't hurt if it's called multiple times.
Comment #13
Jackinloadup CreditAttribution: Jackinloadup commentedsubscribe
Comment #14
Jackinloadup CreditAttribution: Jackinloadup commentedby the way if you comment out any lines that have to do with "browserextra" it will work. Granted without ie6 and old firefox support.... o well.
hope that works for you. till there is a proper fix
Comment #15
frjo CreditAttribution: frjo commentedIn 6-dev tb_setBrowserExtra() is now moved to the top of tb_show().
Comment #16
seancr CreditAttribution: seancr commentedI'm having this problem.
Thickbox wont load anything. Using latest version of drupal and thickbox.
Comment #17
frjo CreditAttribution: frjo commentedPlease try the latest 6-dev version.
Comment #18
daljeet1985 CreditAttribution: daljeet1985 commentedI am using thickbox 6.x-1.4 module and got an "$.browser extra is undefined" error on line 359 and it doesnt load in IE7 as well.
Comment #19
frjo CreditAttribution: frjo commentedAre you calling tb_show() directly?
Try the 6-dev version and see if that fix the problem.
Comment #21
cosmogenesis CreditAttribution: cosmogenesis commentedI installed the latest dev version and am getting the same error. Please help!
Comment #22
cosmogenesis CreditAttribution: cosmogenesis commentedIt seems that the error is occurs when tb_position is called.
Comment #23
noah CreditAttribution: noah commentedAdding:
tb_setBrowserExtra();
at the beginning of tb_position() seems to work around the issue.
Comment #24
p.brouwers CreditAttribution: p.brouwers commentedSo, just the same issue as with tb_show()?
Then let's move tb_setBrowserExtra() also to the top of tb_show().
Comment #25
AaronBaumanThis problem cropped up again for me.
Even though tb_setBrowserExtra() is called at the top of tb_show, $('#TB_ajaxContent').load is bound to an anonymous function that calls tb_position() in a different scope, causing the "$.browserextra undefined" javascript error.
This patch adds tb_setBrowserExtra() before the offending call to tb_position()
Comment #26
AaronBaumanComment #27
frjo CreditAttribution: frjo commentedCommitted to 6-dev. Thanks for the patch.
I encourage Thickbox users to try out the new Colorbox module. It's more modern and nicer overall. I will not make a Thickbox version for D7, instead Colorbox will be the suggested upgrade path.
Comment #29
kinosura CreditAttribution: kinosura commented#23 noah
Thanx! It works for me.
drupal 6.19
ajax 6.x-1.14
thickbox 6.x-1.6 (ThickBox 3.1)
An error was:
$.browserextra is undefined [Break on this error] (327 out of range 66)
while opening a page via Ajax + Thickbox in Mozilla and IE
Comment #30
vood002 CreditAttribution: vood002 commentedWas experiencing the same issue with tb/emfield
The fix in #23 worked for me.
If this doesn't cause any side effects then can we get it rolled into the module?