Software Archive
Read-only legacy content
17061 Discussions

Why are Button Clicks slow in IE

phil_J_
New Contributor I
512 Views

I'm creating a WebApp - using jquery, multipages and some of the buttons in XDK

I have a HOME page with 2 buttons - and 2 sub pages.

In the Emulator - click a button it jumps straight to the sub page.

If I try it ion a web browser, IE11, or even in a smartphone like safari, I have to click the button several times before it moves to the subpage...

Any reason for this - and how can I fix it....

(I'm testing in browser because I have some Fbook functions in it that don't work in the emulator).

 

Phil

 

 

 

 

0 Kudos
1 Solution
Diego_Calp
Valued Contributor I
512 Views

What worked for me is just modify init-dev.js replacing the existing lines

dev.INSURANCE = 250 ;                   // ms, insurance on registering ready events detected
dev.WINDOW_LOAD = 500 ;                 // ms, for combating premature window load events
dev.BROWSER = 7000 ;                    // ms, detecting in a browser (probably best at >5 seconds)
dev.FAIL_SAFE = 10000 ;                 // ms, if all else fails, this saves our bacon :-)

with

if( typeof window.cordova !== "undefined" ) // if real cordova.js is present, we should detect a "deviceready"...
    dev.BROWSER = dev.BROWSER || 7000 ;     // ...best if >5 seconds when Cordova is expected to be present

dev.INSURANCE = dev.INSURANCE || 250 ;      // msecs, insurance on registering ready events detected
dev.WINDOW_LOAD = dev.WINDOW_LOAD || 500 ;  // msecs, for combating premature window load events
dev.BROWSER = dev.BROWSER || 500 ;          // msecs, non-Cordova apps don't care about "deviceready" events
dev.FAIL_SAFE = dev.FAIL_SAFE || 10000 ;    // msecs, if all else fails, this saves our bacon :-)

I did not need to change index.html, just changing init-dev.js placed at www/xdk dir is enough.

 

 

View solution in original post

0 Kudos
6 Replies
Diego_Calp
Valued Contributor I
512 Views

Hi Phil,

This post may help you:

Web App delay to take clicks [SOLVED]

Regards

Diego

0 Kudos
phil_J_
New Contributor I
512 Views

Thanks for that - tried it but it didn't help ...I've realise it isn't just a delay after clicking - I seem to need to click 3 or 4 times - then it will go to next page ??

 

 

0 Kudos
Diego_Calp
Valued Contributor I
512 Views

That seems to me the behavior of my web apps before the fix of the code I've sent you. It seems to take several clicks to respond but was just a matter of time.

What happen if you open the web app and wait 10 or 15 seconds? It takes at the first click?

The fix worked for me in all cases, but I don´t use any flavor of IE.

Regards

Diego

0 Kudos
phil_J_
New Contributor I
512 Views

Yes it does work if I leave for a while...have tried in a couple of browsers but same problem.

I've added this to the init-dev.js

if( typeof window.cordova !== "undefined")
 dev.BROWSER = dev.BROWSER || 7000;
 
dev.INSURANCE || 250 ;                   // ms, insurance on registering ready events detected
dev.WINDOW_LOAD || 500 ;                 // ms, for combating premature window load events
dev.BROWSER || 500 ;                    // ms, detecting in a browser (probably best at >5 seconds)
dev.FAIL_SAFE || 10000 ;                 // ms, if all else fails, this saves our bacon :-)
 

and also this into my HEAD

<script type="text/javascript">

     window.dev = window.dev || {} ; 
     dev.BROWSER = 250 ;
 </script>
 <script src="xdk/init-dev.js"></script>

 

Does it matter where I put it?

 

 

 

0 Kudos
Diego_Calp
Valued Contributor I
513 Views

What worked for me is just modify init-dev.js replacing the existing lines

dev.INSURANCE = 250 ;                   // ms, insurance on registering ready events detected
dev.WINDOW_LOAD = 500 ;                 // ms, for combating premature window load events
dev.BROWSER = 7000 ;                    // ms, detecting in a browser (probably best at >5 seconds)
dev.FAIL_SAFE = 10000 ;                 // ms, if all else fails, this saves our bacon :-)

with

if( typeof window.cordova !== "undefined" ) // if real cordova.js is present, we should detect a "deviceready"...
    dev.BROWSER = dev.BROWSER || 7000 ;     // ...best if >5 seconds when Cordova is expected to be present

dev.INSURANCE = dev.INSURANCE || 250 ;      // msecs, insurance on registering ready events detected
dev.WINDOW_LOAD = dev.WINDOW_LOAD || 500 ;  // msecs, for combating premature window load events
dev.BROWSER = dev.BROWSER || 500 ;          // msecs, non-Cordova apps don't care about "deviceready" events
dev.FAIL_SAFE = dev.FAIL_SAFE || 10000 ;    // msecs, if all else fails, this saves our bacon :-)

I did not need to change index.html, just changing init-dev.js placed at www/xdk dir is enough.

 

 

0 Kudos
PaulF_IntelCorp
Employee
512 Views

Phil -- use the technique that Diego prescribed, it will work more reliably than modifying the delays. It checks to determine if you are in a browser or in a packaged Cordova app and sets the "dev.BROWSER" value appropriately. This way you can package it as an app or run it in a browser without having to change any code.

0 Kudos
Reply