New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activeBtn is not defined #3723

Closed
inspektor99 opened this Issue Mar 2, 2012 · 12 comments

Comments

Projects
None yet
8 participants
@inspektor99

I get this error when I simply try to load a page in a web view on my Android application. I am using a Samsung Galaxy Player 5.0 running Android version 2.3.5.

I removed all custom JavaScript and HTML elements except for the main div with data-role="page" and I still see the problem.

This error is intermittent and happens about 50% of the time (it seems). Also this always happens if I change my app's orientation, forcing a re-load.

I am using jquery.mobile-1.1.0-rc.1.js with jquery-1.7.1.min.js

The error occurs on line 7269. I am able to fix (no idea if this is a correct fix) by declaring activeBtn = null; above line 7292.

var activeBtn = null; //TEMP FIX so i can reliably run my app $.extend($.mobile, { // turn on/off page loading message. showPageLoadingMsg: function (theme, msgText, textonly) { $html.addClass("ui-loading"); ...
@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Mar 3, 2012

Contributor

@inspektor99

If you can post a sample of the page in the form of a jsbin or jsfiddle that would be extremely helpful. Thanks!

Contributor

johnbender commented Mar 3, 2012

@inspektor99

If you can post a sample of the page in the form of a jsbin or jsfiddle that would be extremely helpful. Thanks!

@rogerpadilla

This comment has been minimized.

Show comment
Hide comment
@rogerpadilla

rogerpadilla Mar 4, 2012

I've exactly the same problem using the exact code from here http://jquerymobile.com/demos/1.1.0-rc.1/docs/pages/multipage-template.html.

Tested in a Samsung Galaxy S2 with Android 2.3.4.

I've exactly the same problem using the exact code from here http://jquerymobile.com/demos/1.1.0-rc.1/docs/pages/multipage-template.html.

Tested in a Samsung Galaxy S2 with Android 2.3.4.

@lmigdal

This comment has been minimized.

Show comment
Hide comment
@lmigdal

lmigdal Mar 4, 2012

The same here - Samsung Galaxy S2, Android 2.3.4. No problem in 1.0.1.

lmigdal commented Mar 4, 2012

The same here - Samsung Galaxy S2, Android 2.3.4. No problem in 1.0.1.

@romanbsd

This comment has been minimized.

Show comment
Hide comment
@romanbsd

romanbsd Mar 4, 2012

Same here. Fails in line 7271 (activeBtn.length):

function fakeFixLoader(){
        $loader
            .css({
                top: $.support.scrollTop && $window.scrollTop() + $window.height() / 2 ||
                activeBtn.length && activeBtn.offset().top || 100
Uncaught ReferenceError: activeBtn is not defined
            });     
    }

Temporary workaround for me was to declare a global var activeBtn = [];

romanbsd commented Mar 4, 2012

Same here. Fails in line 7271 (activeBtn.length):

function fakeFixLoader(){
        $loader
            .css({
                top: $.support.scrollTop && $window.scrollTop() + $window.height() / 2 ||
                activeBtn.length && activeBtn.offset().top || 100
Uncaught ReferenceError: activeBtn is not defined
            });     
    }

Temporary workaround for me was to declare a global var activeBtn = [];

@rogerpadilla

This comment has been minimized.

Show comment
Hide comment
@rogerpadilla

rogerpadilla Mar 4, 2012

IMHO, the following is a better temporary workaround (checking if the global variable "activeBtn" was defined before referencing it or its properties). Please note I just added "window.activeBtn && " to the beginning of the line 7271.

window.activeBtn && activeBtn.length && activeBtn.offset().top ...

In that way you'll not overwrite the variable in the cases it came already initialized.

IMHO, the following is a better temporary workaround (checking if the global variable "activeBtn" was defined before referencing it or its properties). Please note I just added "window.activeBtn && " to the beginning of the line 7271.

window.activeBtn && activeBtn.length && activeBtn.offset().top ...

In that way you'll not overwrite the variable in the cases it came already initialized.

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Mar 5, 2012

Contributor

@scottjehl

This looks like fallout from cde86da. Passing the activeBtn around to the helper function bindings is going to take a bit of work so I thought it would be best if you could take a look.

Contributor

johnbender commented Mar 5, 2012

@scottjehl

This looks like fallout from cde86da. Passing the activeBtn around to the helper function bindings is going to take a bit of work so I thought it would be best if you could take a look.

@audreyr

This comment has been minimized.

Show comment
Hide comment
@audreyr

audreyr Mar 6, 2012

Just letting you know that I'm running into this too, on an HTC MyTouch 3G running Android 2.2.1. I'm also using jquery.mobile-1.1.0-rc.1.min.js with jquery-1.7.1.min.js (and phonegap-1.4.1.js).

audreyr commented Mar 6, 2012

Just letting you know that I'm running into this too, on an HTC MyTouch 3G running Android 2.2.1. I'm also using jquery.mobile-1.1.0-rc.1.min.js with jquery-1.7.1.min.js (and phonegap-1.4.1.js).

@johnbender johnbender closed this in 43f2d61 Mar 7, 2012

@johnbender

This comment has been minimized.

Show comment
Hide comment
@johnbender

johnbender Mar 7, 2012

Contributor

All,

Give the latest a whirl by using http://code.jquery.com/mobile/latest/jquery.mobile.js as your jquery mobile include and let me know if this fixes the issue.

Contributor

johnbender commented Mar 7, 2012

All,

Give the latest a whirl by using http://code.jquery.com/mobile/latest/jquery.mobile.js as your jquery mobile include and let me know if this fixes the issue.

@lmigdal

This comment has been minimized.

Show comment
Hide comment
@lmigdal

lmigdal Mar 10, 2012

I tested the app few times and the error is not showing up, thanks :) Still I've noticed that with this version the fixed footer doesn't work :)

lmigdal commented Mar 10, 2012

I tested the app few times and the error is not showing up, thanks :) Still I've noticed that with this version the fixed footer doesn't work :)

@sub

This comment has been minimized.

Show comment
Hide comment
@sub

sub Mar 22, 2012

Hi John, I had the same problem and latest jquerymobile solved it.
Thanks! :-)

sub commented Mar 22, 2012

Hi John, I had the same problem and latest jquerymobile solved it.
Thanks! :-)

@inspektor99

This comment has been minimized.

Show comment
Hide comment
@inspektor99

inspektor99 Mar 26, 2012

Confirming the fix. Thanks!

Confirming the fix. Thanks!

@jaiversin

This comment has been minimized.

Show comment
Hide comment
@jaiversin

jaiversin Apr 17, 2012

Another confirmation of the fix: Samsung Galaxy Tab 10.1 - Android 3.1
Upgraded from 1.1.0-rc.1 to lastest.

Another confirmation of the fix: Samsung Galaxy Tab 10.1 - Android 3.1
Upgraded from 1.1.0-rc.1 to lastest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment