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 )
};
}

CommentFileSizeAuthor
#25 463566-thickbox-browserextra.patch497 bytesAaronBauman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

StevenPatz’s picture

Priority: Critical » Normal
Status: Active » Fixed

This appears to be fixed in the dev version.

frjo’s picture

According to another issue it only effects Internet Explorer so I have not noticed it myself.

ZeroIQ’s picture

Yes 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 :-)

frjo’s picture

A new official release, 6.x-1.4, now has this fix.

ZeroIQ’s picture

cool thank you :-)

btopro’s picture

Status: Fixed » Active

I'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.

frjo’s picture

Version: 6.x-1.3 » 6.x-1.4

Have 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.

criznach’s picture

btopro: 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.

btopro’s picture

Ya 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?

frjo’s picture

Category: bug » support

Yes you should.

Any opinions on moving tb_setBrowserExtra() to the top of tb_show()?

criznach’s picture

That 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.

p.brouwers’s picture

I 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.

Jackinloadup’s picture

subscribe

Jackinloadup’s picture

by 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

frjo’s picture

Status: Active » Fixed

In 6-dev tb_setBrowserExtra() is now moved to the top of tb_show().

seancr’s picture

I'm having this problem.

$.browserextra is undefined
[Break on this error] (322 out of range 247)

Thickbox wont load anything. Using latest version of drupal and thickbox.

frjo’s picture

Version: 6.x-1.4 » 6.x-1.x-dev

Please try the latest 6-dev version.

daljeet1985’s picture

I 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.

frjo’s picture

Are you calling tb_show() directly?

Try the 6-dev version and see if that fix the problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cosmogenesis’s picture

I installed the latest dev version and am getting the same error. Please help!

cosmogenesis’s picture

It seems that the error is occurs when tb_position is called.

noah’s picture

Adding:

tb_setBrowserExtra();

at the beginning of tb_position() seems to work around the issue.

p.brouwers’s picture

So, just the same issue as with tb_show()?

Then let's move tb_setBrowserExtra() also to the top of tb_show().

AaronBauman’s picture

Status: Closed (fixed) » Needs review
FileSize
497 bytes

This 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()

AaronBauman’s picture

Category: support » bug
frjo’s picture

Assigned: Unassigned » frjo
Status: Needs review » Fixed

Committed 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kinosura’s picture

#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

vood002’s picture

Was 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?