简体   繁体   中英

javascript error in Firefox windows 7, working in other browsers an OS

Hi this code seems to work fine in all browsers, just firefox in windows 7, is giving this issue, in firefox windows 8 (firefox 28,29) its ok. so i dont get it

This is a page i did not write, but im fixing some issues, this particular error its out of my knowledge wich is very basic yet.

So firefox gives this error

ReferenceError: autoExpire is not defined.

my first tought was to define var autoExpire; in javascript. But then looking at code there is a function autoExpire () is this the issue? why is working in other browsers, why is not working on windows 7?

Hope you can help me , here is the code.

    if(Get_Cookie('<?php echo COOKIE_REMEMBER_ME;?>') ==0)
    {
        if(Get_Cookie('<?php echo COOKIE_LOGINID;?>'))
        var aexp=setInterval(autoExpire,10000);


        if(!autocount)
        {
            var autocount;
            autocount=0;
        }

        function autoExpire()
        {
            autocount=autocount+1;
            if(autocount > parseInt(<?php echo COOKIE_EXPIRY_TIME*6;?>))
            {
                clearInterval(aexp);
                window.location.href='<?php echo $this->make_base_url("user/logout/a");?>';
            }
        }
    }

EDIT

Yes, this function is inside

$(document).ready(function() {

    }

With other functions to, the only error i can see is this thats why i just copy the function with error.

You're calling the function before it's defined.

Try this.

if (Get_Cookie('<?php echo COOKIE_REMEMBER_ME;?>') == 0) {
    if (Get_Cookie('<?php echo COOKIE_LOGINID;?>'))

    function autoExpire() {
        autocount = autocount + 1;
        if (autocount > parseInt( <? php echo COOKIE_EXPIRY_TIME * 6; ?> )) {
            clearInterval(aexp);
            window.location.href = '<?php echo $this->make_base_url("user/logout/a");?   >';
        }
    }

    var aexp = setInterval(autoExpire, 10000);

    if (!autocount) {
        var autocount;
        autocount = 0;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM