Re: Gecko (Moz/NS) Script Issues
Re: Gecko (Moz/NS) Script Issues
- Subject: Re: Gecko (Moz/NS) Script Issues
- From: julifos <email@hidden>
- Date: Tue, 14 Jan 2003 10:03:10 +0100
>
When I run the AS:
>
>
set y to do javascript "document.title"
>
>
then I get an error:
>
>
"document.title" doesn't understand the Do Javascript message.
>
>
Am I sending the script text in an improper way with the Do JavaScript
>
command? (Using 'with' doesn't compile; putting the script in a var doesn't
>
help.)
>
>
Are you able to get the position, unique ID or busy status of a window in
>
Moz/NS?
>
>
--
>
Gary
Definitively, apple events are a died bird on Netscape, specially "Do
Javascript" command.
A workaround to send javascript commands to NS/Mozilla is "GetURL" command,
but you won't retrieve data of any kind. Anyway:
set thecode to "document.title"
tell application "Netscape" --> v. 7
GetURL "javascript:" & thecode & "" inside window 1
end tell
--> this will write the title of the doc to the first window
--> which is a pretty & useless stupid thing
To avoid this "output", you must enclose your js commands in a void:
set thecode to "document.title"
tell application "Netscape"
GetURL "javascript:void(" & thecode & ")" inside window 1
end tell
--> Netscape grabs the title but won't return it to you,
--> because this is supposed to be the function of "Do JavaScript" ;-)
Finally, if you're planning work with any *GUI* methods, you must delete the
"void" statement:
set thecode to "document.write(document.title)"
set thecode2 to "x=document.title;window.alert(x);"
tell application "Netscape"
GetURL "javascript:void(" & thecode & ")" inside window 1
--> won't work
GetURL "javascript:void(" & thecode2 & ")" inside window 1
--> won't work
GetURL "javascript:& thecode inside window 1
--> will work
GetURL "javascript:" & thecode2 inside window 1
--> will work
end tell
"unique ID" won't work. Also, "OpenURL" should return some info (window id),
but neither.
"position" won't work.
"busy" won't work, but if the window is busy while you run "busy of window
1", it will wait until it has loaded the entire page, then will throw an
error.
JJ, who is waiting for "do javascript"'s safari command.
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.