Re: Test to see if web browser can run java script...
Re: Test to see if web browser can run java script...
- Subject: Re: Test to see if web browser can run java script...
- From: "Gary (Lists)" <email@hidden>
- Date: Thu, 30 Jun 2005 06:53:51 -0400
"David Siberry" wrote:
> Hi,
>
> I have written a script to test to see if a web browser can run java
> script my calling the "do script" or "do JavaScript" methods contained
> within a browsers dictionary.
>
> I have managed to write a script that works for Safari and Internet
> Explorer, but I cant figure out how to write a script for OmniWeb v5.1
...
> I would like to port the script below so it will work with OmniWeb v5.1.
>
> Here is the script for Internet Explorer:
>
> try
> run script "tell application \"Internet Explorer\"
> CloseAllWindows
> do script \"window.name\" window -1
> end tell"
I guess you are trying to compile the script without resolving
terminology...? Is that why you prefer the awkward 'run script' over just
telling IE directly? (I've been scripting IE for a few years, and I've not
seen that need.)
I don't understand the script logic. First you want to close every window,
and then you want to run a javascript that gets the name of a window (that
you just closed)?
window -1 means "current (top) window" in Internet Explorer's dictionary.
window 0 means "new window".
Anyway, why don't you just use the provided JavaScript method for
determining whether Java is enabled?
if (navigator.javaEnabled() < 1) myJavaVar="No"; [1]
if (navigator.javaEnabled() == 1) myJavaVar="Yes";
--
Gary
IE technically uses Jscript -- yeah, MS -- and so you may need to use:
== 0 ... I can't remember why I use that < 1 workaround. You would expect
0 or 1, but maybe some JS implementations (browsers) use a strange boolean
for 0. Anyway, just note this issue, and try both if you are getting
unexpected results. [Do not use =, of course, which is an easy AS <-> JS
mistake.]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden