Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #13521 > unrolled thread
| Started by | "Richard Maher" <maher_rj@hotspamnotmail.com> |
|---|---|
| First post | 2012-04-22 12:46 +0800 |
| Last post | 2012-04-23 20:40 -0300 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: JSObject.call(method, ARGS) with Safari "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-04-22 12:46 +0800
Re: JSObject.call(method, ARGS) with Safari "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-04-22 15:07 +0800
Re: JSObject.call(method, ARGS) with Safari Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-22 21:17 -0300
Re: JSObject.call(method, ARGS) with Safari Richard Maher <maherrj@googlemail.com> - 2012-04-22 23:40 -0700
Re: JSObject.call(method, ARGS) with Safari Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-04-23 20:40 -0300
| From | "Richard Maher" <maher_rj@hotspamnotmail.com> |
|---|---|
| Date | 2012-04-22 12:46 +0800 |
| Subject | Re: JSObject.call(method, ARGS) with Safari |
| Message-ID | <jn02en$5gp$1@speranza.aioe.org> |
"Daniel Pitts" <newsgroup.nospam@virtualinfinity.net> wrote in message
news:YOGkr.11325$DB1.340@newsfe03.iad...
> On 4/21/12 3:12 AM, Richard Maher wrote:
>> Hi.
>>
>> Has anyone been able to pass the ARGS parameter to JSObject's "call"
>> method
>> *and* pass arguments via the "args" parameter? An example of your
>> work-around perhaps?
>>
>> I'm having no trouble calling methods on all sorts of complex Javascript
>> objects but when it comes to passing the arguments array I keep getting
>> nullpointerexception :-(
>>
>> Firefox, IE, Chrome, and Opera are all onboard and ok.
>>
>> Cheers Richard Maher
> Not sure if this helps, but in the past I've had to do some hacky
> work-arounds to work with JSObject.
>
> Check out:
> <http://virtualinfinity.net/wordpress/tools/2008/10/11/javascript-and-java-applets/>
>
Hi Daniel,
Thanks as always for your replies.
>
> Hope this helps,
It certainly helped a couple of years ago (with FireFox 2.n or 3.0?) when
you first showed me your cunning solution. That was my first (well probably
about 5th as is happens) port of call.
You may not recall, but that's when I first introduced the JS
"Tier3Client.launder" function that just took a JSObject a a parameter and
returned the same JSObject which was automagically fixed/rinsed. This worked
well back in the day but now FF, IE, Chrome, and Opera (and JSObject) all
seemed to have moved on and the "fix" was looking redundant - until Safari
and its insistence on the "First Generation plug-in" :-(
The problem is my solution is not working with Safari and I think Safari has
other issues. I used to getMember("Tier3Client") on the applet window and
then call my "launder" on that. If you look at the code I posted just before
you'll see that I was trying to be "clever" and use an anonymous JS function
to return a launder function. As this could well have been an issue, I
reverted to the tried and tested method but still no joy.
Anyway, I'll give your code/solution a go shortly but I'm not hopeful given
that I can't even get a simple appletWindow.call("topLevelFunction", args)
to do other than return "null". Without arguments is not a problem.
So in the meantime if anyone knows of an example JSObject.call("sayHello",
WITHargs) that works in Safari can they please provide a pointer?
> Daniel.
Cheers Richard Maher
PS. NO *NOT bloody EVAL* - call, Call, CALL()!
[toc] | [next] | [standalone]
| From | "Richard Maher" <maher_rj@hotspamnotmail.com> |
|---|---|
| Date | 2012-04-22 15:07 +0800 |
| Message-ID | <jn0anp$l3v$1@speranza.aioe.org> |
| In reply to | #13521 |
"Richard Maher" <maher_rj@hotspamnotmail.com> wrote in message
news:jn02en$5gp$1@speranza.aioe.org...
>
> "Daniel Pitts" <newsgroup.nospam@virtualinfinity.net> wrote in message
> news:YOGkr.11325$DB1.340@newsfe03.iad...
>> Not sure if this helps, but in the past I've had to do some hacky
>> work-arounds to work with JSObject.
>>
>> Check out:
>> <http://virtualinfinity.net/wordpress/tools/2008/10/11/javascript-and-java-applets/>
>>
>
> Anyway, I'll give your code/solution a go shortly but I'm not hopeful
> given that I can't even get a simple appletWindow.call("topLevelFunction",
> args) to do other than return "null". Without arguments is not a problem.
>
> So in the meantime if anyone knows of an example JSObject.call("sayHello",
> WITHargs) that works in Safari can they please provide a pointer?
>
>> Daniel.
As expected, still no joy and a nullpointer. (And now IE complains that you
can't cast a String to JSObject)
Thanks anyway.
Anyone else done this on Safari?
>
Cheers Richard Maher
>
> PS. NO *NOT bloody EVAL* - call, Call, CALL()!
>
[toc] | [prev] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
|---|---|
| Date | 2012-04-22 21:17 -0300 |
| Message-ID | <Pc1lr.11621$M37.265@newsfe01.iad> |
| In reply to | #13525 |
On 12-04-22 04:07 AM, Richard Maher wrote:
> "Richard Maher" <maher_rj@hotspamnotmail.com> wrote in message
> news:jn02en$5gp$1@speranza.aioe.org...
>>
>> "Daniel Pitts" <newsgroup.nospam@virtualinfinity.net> wrote in message
>> news:YOGkr.11325$DB1.340@newsfe03.iad...
>
>>> Not sure if this helps, but in the past I've had to do some hacky
>>> work-arounds to work with JSObject.
>>>
>>> Check out:
>>> <http://virtualinfinity.net/wordpress/tools/2008/10/11/javascript-and-java-applets/>
>>>
>>
>> Anyway, I'll give your code/solution a go shortly but I'm not hopeful
>> given that I can't even get a simple appletWindow.call("topLevelFunction",
>> args) to do other than return "null". Without arguments is not a problem.
>>
>> So in the meantime if anyone knows of an example JSObject.call("sayHello",
>> WITHargs) that works in Safari can they please provide a pointer?
>>
>>> Daniel.
>
> As expected, still no joy and a nullpointer. (And now IE complains that you
> can't cast a String to JSObject)
>
> Thanks anyway.
>
> Anyone else done this on Safari?
>>
> Cheers Richard Maher
>>
>> PS. NO *NOT bloody EVAL* - call, Call, CALL()!
>>
I don't usually deal with Java applets of any kind, but this was
interesting. I worked up a Swing JApplet and have a JavaScript function
an a JSP page.
Since you mentioned Safari I did Safari 5.1.2 on Mac OS X 10.6.8 with
Java Plug-in 1.6.0_31.
The applet has text fields to take 2 numbers, a result text field, and a
"submit" button. The JavaScript function is
function addNums(one,two) {
return one+two;
}
and the important 2 lines of code in the applet are
JSObject win = JSObject.getWindow(this);
Object sum = win.call("addNums", new Object[] {num1, num2});
where 'num1' and 'num2' are java.lang.Doubles. So is 'sum'.
There is not anything more to it. It worked just fine.
AHS
--
A fly was very close to being called a "land," cause that's what they do
half the time.
-- Mitch Hedberg
[toc] | [prev] | [next] | [standalone]
| From | Richard Maher <maherrj@googlemail.com> |
|---|---|
| Date | 2012-04-22 23:40 -0700 |
| Message-ID | <c5e9f046-ed19-4f45-aa5f-a280f0520f34@t2g2000pbl.googlegroups.com> |
| In reply to | #13535 |
Hi Arved,
On Apr 23, 8:17 am, Arved Sandstrom <asandstrom3min...@eastlink.ca>
wrote:
> On 12-04-22 04:07 AM, Richard Maher wrote:
>
> Since you mentioned Safari I did Safari 5.1.2 on
>>> Mac OS X 10.6.8 with <<<<
Well there goes 3 days of my life I'll never get back :-( I guess some
would say I deserve it for not being a OS/X user. I should have
pointed out that I was running Safari of Windows XP but on 2nd
thoughts, who cares? I can't see many users choosing to browse with
Safari on Windows so, in the grand scheme of things it can stay broke.
(Shame to not be able to test there though).
. A couple of other observations on Safari Liveconnect support for
those following at home
1) removeMember is not support on WIN or OS/X (Either does Chrome for
that matter)
2) WIN Safari supports get/set Member but OS/X does not
> Java Plug-in 1.6.0_31.
>
> The applet has text fields to take 2 numbers, a result text field, and a
> "submit" button. The JavaScript function is
>
> function addNums(one,two) {
> return one+two;
>
> }
>
> and the important 2 lines of code in the applet are
>
> JSObject win = JSObject.getWindow(this);
> Object sum = win.call("addNums", new Object[] {num1, num2});
>
> where 'num1' and 'num2' are java.lang.Doubles. So is 'sum'.
>
> There is not anything more to it. It worked just fine.
Yep, pretty wonderful and useful stuff eh?
Thanks for testing it for me.
>
> AHS
>
Cheers Richard Maher
[toc] | [prev] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
|---|---|
| Date | 2012-04-23 20:40 -0300 |
| Message-ID | <TLllr.66389$YM2.10202@newsfe05.iad> |
| In reply to | #13537 |
On 12-04-23 03:40 AM, Richard Maher wrote: > Hi Arved, > > On Apr 23, 8:17 am, Arved Sandstrom <asandstrom3min...@eastlink.ca> > wrote: >> On 12-04-22 04:07 AM, Richard Maher wrote: >> > >> Since you mentioned Safari I did Safari 5.1.2 on > >>>> Mac OS X 10.6.8 with <<<< > > Well there goes 3 days of my life I'll never get back :-( I guess some > would say I deserve it for not being a OS/X user. I should have > pointed out that I was running Safari of Windows XP but on 2nd > thoughts, who cares? I can't see many users choosing to browse with > Safari on Windows so, in the grand scheme of things it can stay broke. > (Shame to not be able to test there though). [ SNIP ] > > Thanks for testing it for me. >> >> AHS > > Cheers Richard Maher I'm not one to resist a challenge, I tested the applet against Safari on my Windows XP, and it worked also. Safari 5.0.3, Windows XP, JDK 1.6.0_31 (and corresponding plugin). FWIW my test environment is very spare. The JApplet itself is uncomplicated, and the 2 lines I showed you are the only ones that talk to JavaScript. The JavaScript is the function I showed, and it's the only JavaScript in the page that contains the applet. And my applet tag *is* an <applet> tag, not an <object> tag, with only the 'code' and 'archive' attributes. I'm not saying you want to, or can, simplify that much (considering you want to support many browsers) but it's what worked for me in Safari on both Mac OS X and Win XP for this scenario. AHS -- A fly was very close to being called a "land," cause that's what they do half the time. -- Mitch Hedberg
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web