Reputation: 694
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.
Upvotes: 0
Views: 50
Reputation: 5260
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;
}
}
Upvotes: 2