Apple launches Apple Store app in India

The Apple Store app provides customers with the most personalized way to shop for Apple’s innovative lineup of products and services. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to refresh html widget on open

Hi


I have made html widget that contains simple drag&drop game with html5 and java script. Problem is that in browser if i refresh (F5 or cmd+R) it reloads page and starts onload() function in body if my html document. But in iBook closing widget and than opening it again does not force refresh or onload() function in body of my html document. How do i force oload() every time user opens html widget?


tnx

Luka

iBook, iOS 5.0.1

Posted on Jan 30, 2012 5:19 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 30, 2012 6:05 AM

You need to define the widget.didEnterWidgetMode function in your javascript for this. It will get called when your widget gets reopened from a document, and from here you can call your onload, init or start functions as required.


e.g. :


widget.didEnterWidgetMode = function(widgetState) {

// Call functions here as needed


}


Note that this only gets called on reopening events (not on the very first time your widget loads - use onload as usual for this).


Rhys

3 replies
Sort By: 
Question marked as Top-ranking reply

Jan 30, 2012 6:05 AM in response to luka.mis

You need to define the widget.didEnterWidgetMode function in your javascript for this. It will get called when your widget gets reopened from a document, and from here you can call your onload, init or start functions as required.


e.g. :


widget.didEnterWidgetMode = function(widgetState) {

// Call functions here as needed


}


Note that this only gets called on reopening events (not on the very first time your widget loads - use onload as usual for this).


Rhys

Reply

Jan 30, 2012 9:35 AM in response to luka.mis

Hi,

docs are here:

http://developer.apple.com/library/mac/#documentation/AppleApplications/Conceptu al/Dashboard_ProgTopics/Articles/Events.html#//apple_ref/doc/uid/TP40003044-SW1

but I cannot see one provided you by Rhys, so I wonder if docs are up-to-date.


regards,

Peter

Reply

How to refresh html widget on open

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.