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
chetan_sudra
Posts: 3
Registered: ‎02-08-2010
My Device: 8700
My Carrier: 2

Web page is not refreshing while goes to idle mode, Timer has been stopped.

I'm working on WebApps, Javascript application for on-line examination. I am polling service method to get question status and remaining time for active question. Everything works fine in normal mode but once Device goes to idle mode page execution has been stopped (Used timer for polling so in idle mode, Javascript function has been disable)
When come back to normal mode, all timer has been stopped and not getting the updated data from the server.

Is it default behaviour for BlackBerry browers or any method/technique to resolve this issue?
Please use plain text.
BlackBerry Development Advisor (Retired)
pbhattacherjee
Posts: 33
Registered: ‎08-07-2009
My Device: Not Specified

Re: Web page is not refreshing while goes to idle mode, Timer has been stopped.

Hi,

 

You'll need to include an IFrame with a meta tag refresh instead to call you JavaScript.  I've included an example below, and there will be a blog post shortly around this topic.  This example will reawaken the JavaScript and resume it's functionality.

 

Thanks,

 

Prosanta

 

index.html

<html>

<head>

<title>This is a test</title>

<script type="text/javascript">

    function wakeUp() {

        var time = new Date();

        document.getElementById('spnTime').innerHTML = time.toLocaleTimeString();

    }

</script>

</head>

    <body>

        The time is: <span id="spnTime"></span>

        <iframe width="1px" height="1px" src="autorefresh.html"></iframe>

    </body>

</html>

 

autorefresh.html

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <META HTTP-EQUIV="refresh" CONTENT="5"/>

        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PUBLIC"/>

        <script language="javascript">window.parent.wakeUp();</script>

    </head>

    <body>

        iframe

    </body>

</html>

Please use plain text.
New Contributor
chetan_sudra
Posts: 3
Registered: ‎02-08-2010
My Device: 8700
My Carrier: 2

Re: Web page is not refreshing while goes to idle mode, Timer has been stopped.

Thank you very much Prasanta B,

Please use plain text.