jQuery App works on Localhost, Mobile Devices, but does not work on browsers

0

I developed a small application using HTML5 and jQuery.

It works perfectly on localhost. I uploaded the whole code, and a specific routine did not work in any of the browsers (Chrome, Firefox or Opera).

I tested it on iPhone Safari and it also did not work. I figured I might have forgotten to climb some file, but in the last test, when I created a page shortcut on the iPhone, it worked perfectly.

Anyway, I tested on Chrome for Android and also worked without any problems.

Has anyone ever had a similar situation?

I did these two tests and both did not generate anything on the console. I think the problem might be here:

$(document).on('pagebeforeshow', '#pagRanking', function() {
    console.log('before show');
})

$(document).on('pageshow', '#pagRanking', function() {
    console.log('show');
})
    
asked by anonymous 30.01.2014 / 12:40

2 answers

1

pagebeforeshow and pageshow , on the whole, are not compatible with desktop browsers. To do this, choose $(document).ready(...); or $(window).on('load', ...); .

    
30.01.2014 / 12:51
0

Not all browsers are compatible with events pageshow and pagebeforeshow . You can check this for compatibility:

if(window.onpageshow|| window.onpageshow=== null){
   window.addEventListener('pageshow', showFunction, false);
} else {
   window.addEventListener('load', showFunction, false);
}
    
30.01.2014 / 12:49