Can't execute code from a freed script

D

Dirk Gently

I have seen a few posts with respect to this error message, but none
are quite the same situation as mine. My requirements for this web
application are fairly stringent in that the client browsers are
running on public (read: tightly controlled) machines with touch
screens in widely distributed locations. The end users can't have
access to the browser menus or buttons, so any error-type conditions
need to be self-correcting.

I have a simple HTML page which contains a frameset. The frameset has
only one single frame, which contains all of the visible content of my
webapp. The first time it loads, the top page opens a new window via
window.open() with the URL of a separate page on the server. The popup
page is mainly a scripting window which performs the following
actions:

1) tests the server availability by downloading/reloading a one pixel
image (this works great).
2) tests the main window for a JavaScript Date variable which is set
whenever the content frame is reloaded. There are two reasons for this
test - one is simply the availability of the variable, the other is
the value of the timestamp.

The desired behavior is to recover from server downtime, or 404/500
server errors with no navigation by the users. The top page writes a
"retry later" type message into the content frame by setting the
frame's location to a 'javascript:...' pseudo-URL which writes the
personalized error message. To satisfy this I have the popup testing
on an interval (currently 30 seconds). Everything works swimmingly
except for one test case. If the server goes down, and the user
attempts to navigate before the retry message is written, the content
frame reverts to "Page cannot be displayed" IE error page. Once this
occurs, I no longer have access to the child frame to write the
friendly error message. I get the "Can't execute code from a freed
script" JavaScript error.

I attempted to preempt the IE error page by playing tricks with the
frame's document.onUnload event, but that made matters worse so that
many of the other cases no longer functioned. Does anyone else have
experience with this type of scenario?

Thanks,
Chris
 
K

kaeli

I attempted to preempt the IE error page by playing tricks with the
frame's document.onUnload event, but that made matters worse so that
many of the other cases no longer functioned. Does anyone else have
experience with this type of scenario?

If this is guaranteed to be run with IE, why not try a .hta instead of .html?
I believe you get more control over script that way. It may make this error
go away.

If that isn't an option, do you have any control over the server? Custom
404/500 error pages may be a better solution.

If that's not an option either, how do users navigate? You may be able to
disallow navigation until the server is checked.

--
 
D

Dirk Gently

kaeli said:
If this is guaranteed to be run with IE, why not try a .hta instead of .html?
I believe you get more control over script that way. It may make this error
go away.

We attempted to go the HTA route, but were unable to get the page
working properly. The page contains a non-visible signed Java applet
which is used to accept input from a serial bar code reader, and the
applet was not functioning inside of the HTA.
If that isn't an option, do you have any control over the server? Custom
404/500 error pages may be a better solution.

This is not the issue - I can detect a 40x/50x error with no problem
because then the page is still in the same domain as the other
windows/frames. The problem occurs when the server is down, in which
case IE renders the 'Page cannot be displayed' page, which is local to
the machine and therefore from a different 'domain' than the
monitoring script window or the parent frame.
If that's not an option either, how do users navigate? You may be able to
disallow navigation until the server is checked.

The users navigate purely through links on the pages - all other
navigation is disallowed by starting IE with the -K command line
argument. I am trying to figure out how to properly trap all
navigation events (user link clicks or periodic META refreshes) in
order to check the server status. I believe I can solve this problem
by discovering the server status prior to any navigation event and
preventing the child page from reverting to local domain, which causes
it to drop off the radar for the monitor script. Other than that, if
you have any ideas about how to retain a reference to the content
page's document object when it goes to 'Page cannot be displayed',
that would be even better.

Thanks for your reply,
Chris
 
K

kaeli

Most people know how to navigate the web and you could build on the
knowledge by letting the navigation buttons show through.

You missed the original. This is not a standard app. It's a kiosk.

the client browsers are
running on public (read: tightly controlled) machines with touch
screens in widely distributed locations. The end users can't have
access to the browser menus or buttons, so any error-type conditions
need to be self-correcting.

--
--
~kaeli~
To steal ideas from one person is plagiarism; to steal from
many is research.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
K

kaeli

We attempted to go the HTA route, but were unable to get the page
working properly. The page contains a non-visible signed Java applet
which is used to accept input from a serial bar code reader, and the
applet was not functioning inside of the HTA.

There's no good reason for applets not to work in HTAs. Do you have both Sun
and MS JVMs on that machine? The machine may be confused as to which one to
use. Make sure you only have ONE JVM installed.
You may need to put it in a hidden frame or IFRAME.
You may need to use an object tag instead of the applet tag.
This is not the issue - I can detect a 40x/50x error with no problem
because then the page is still in the same domain as the other
windows/frames. The problem occurs when the server is down, in which
case IE renders the 'Page cannot be displayed' page, which is local to
the machine and therefore from a different 'domain' than the
monitoring script window or the parent frame.

That only happens when IE is configured to display friendly error messages,
as far as I know. Check the setting in IE. Advanced tab : "show friendly HTTP
error messages" should be unchecked.
The users navigate purely through links on the pages - all other
navigation is disallowed by starting IE with the -K command line
argument. I am trying to figure out how to properly trap all
navigation events (user link clicks or periodic META refreshes) in
order to check the server status.

You can do that with attachEvent on all links. Do a getElementsByTagName and
iterate through them and attachEvent to each.
Other than that, if
you have any ideas about how to retain a reference to the content
page's document object when it goes to 'Page cannot be displayed',
that would be even better.

Do check that IE advanced option. I wonder if that's the real problem...

--
--
~kaeli~
To steal ideas from one person is plagiarism; to steal from
many is research.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top