Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
philipjmurphy
Posts: 8
Registered: ‎11-07-2011
My Device: BlackBerry Z10

Window blur and focus events do not fire on BB Z10 device

Hi,

 

On Z10 (Model STL100-3 - Version 10.0.10.116), window blur and focus events do not fire when switching between browser tabs - any help appreciated. I just need to know when the user returns to the web page as I may need to renew the user's session.

 

FYI - this code works fine on Chrome Desktop and Chrome Android.

 

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta id="ext-gen1002" name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">

    <title>Test Window Focus and Blur Events</title>

    <script>
        window.onfocus = function() {
            alert('window focus');
        };

        window.onblur = function() {
            alert('window blur');
        };

        alert("onfocus in window: " + ('onfocus' in window)); // Is reported as true on Z10
        alert("onblur in window: " + ('onblur' in window)); // Is reported as true on Z10
    </script>

</head>
<body>
Test Window Focus and Blur Events
</body>
</html>

 

Thanks,

 

Philip

 

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Window blur and focus events do not fire on BB Z10 device

Hi Phillip,

 

I notice you have a very old version of the device OS.  Are you able to update your OS to the latest in-market software available (10.2.1) and try again?

 

If it does persist, this may be a defect to report to our browserdev team.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Trusted Contributor
usr501
Posts: 222
Registered: ‎03-03-2012
My Device: Ripple, LE Z10, Dev Alpha _C, Playbook, Bold 9900

Re: Window blur and focus events do not fire on BB Z10 device

Adam,

I have a similar issue with a texarea with autofocus (called with html5)

App is working fine in ripple but when the app is loaded on 2 devices ( DAC and RED BB10 ) there is no blinking cursor.

cursor is dead.

 

can I send you the file?

 

Bob.

New Contributor
philipjmurphy
Posts: 8
Registered: ‎11-07-2011
My Device: BlackBerry Z10

Re: Window blur and focus events do not fire on BB Z10 device

Hi Adam,

 

I've tried to apply an update, however, when on the software updates' screen, it just sits there spinning. I don't have a SIM card for the device as it is a test device, so maybe that is causing a problem.

 

This issue affects iOS devices as well, so I don't think the "window on blur/focus" events are very reliable in general. I've resorted to a timed interval to check if any session key has expired.

 

Thanks,

 

Philip