spcght440
spcght440

Reputation:

Stopping refresh when flash has focus

How do I stop a browser refresh from happening when a flash object has focus inside a pop up window?

Yes, I abhor pop up windows too. Yet we have a flash questionnaire that is being wrecked from users who use refresh.

I also already have js in place that effectively blocks refresh, UNTIL the flash gets focus and the user presses refresh.

I have access to the Flash through our Flash developer, but he is uncertain of how to do this. The closest we could come up with was to use the fscommand trapallkeys, yet it does not appear to be working.

Upvotes: 0

Views: 625

Answers (3)

sthg
sthg

Reputation: 1135

You'll never be able to block users from refreshing, either with their keyboard or pushing the refresh using their mouse. Instead of spending time trying to block it, I would suggest finding a way to support it.

A good way would be to use Local Shared Objects, to save current progress to the user's flash plugin. These can save variables locally on the users's machine, without using javascript or cookies.

Here's the documentation for flash shared objects.

Using this technique, when a user refreshes, simply reload the variables stored so far and display the questionnaire as it was when user left it.

Upvotes: 1

Gareth
Gareth

Reputation: 138042

Not going to happen.

Your best bet is a banner which says "DO NOT REFRESH THIS PAGE"

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

You can try trapping onbeforeunload, but there's not much else you can do.

See: onbeforeunload support detection

and: Javascript To Get An Alert To Redirect When Closing The Browser Window

Edit:

Refresh is an application-level event, not a client-level event. You're out of luck.

Upvotes: 0

Related Questions