Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » swt browser.execute(javascript) problem
swt browser.execute(javascript) problem [message #554177] Fri, 20 August 2010 08:39 Go to next message
Eclipse UserFriend
Originally posted by: xuesong.wen.gmail.com

Hello, I have a question about browser.execute() method.

why browser.execute("hello world();") can not be sucessfully executed in
UI thread?

code:
....
browser.setUrl("...mysite.html");
browser.execute("helloWorld();");
....

mysite.html

<html>
...
<body>
...
<script type="text/javascript">
function helloWorld(){
alert("hello world!");
}
</script>
</body>
</html>
Re: swt browser.execute(javascript) problem [message #554187 is a reply to message #554177] Fri, 20 August 2010 09:06 Go to previous messageGo to next message
Eclipse UserFriend
Because the page loading in the browser happens in an async fashion (the
ui thread is not blocked) and the page is not loaded yet when you call
the method.

Tom

Am 20.08.10 14:39, schrieb xuesong wen:
> Hello, I have a question about browser.execute() method.
>
> why browser.execute("hello world();") can not be sucessfully executed in
> UI thread?
>
> code:
> ...
> browser.setUrl("...mysite.html");
> browser.execute("helloWorld();");
> ...
>
> mysite.html
>
> <html>
> ...
> <body>
> ...
> <script type="text/javascript">
> function helloWorld(){
> alert("hello world!");
> }
> </script>
> </body>
> </html>
>
Re: swt browser.execute(javascript) problem [message #554188 is a reply to message #554187] Fri, 20 August 2010 09:13 Go to previous messageGo to next message
Eclipse UserFriend
You could try to add a progress listener and call the method when the
page loading is completed.

Tom

Am 20.08.10 15:06, schrieb Tom Schindl:
> Because the page loading in the browser happens in an async fashion (the
> ui thread is not blocked) and the page is not loaded yet when you call
> the method.
>
> Tom
>
> Am 20.08.10 14:39, schrieb xuesong wen:
>> Hello, I have a question about browser.execute() method.
>>
>> why browser.execute("hello world();") can not be sucessfully executed in
>> UI thread?
>>
>> code:
>> ...
>> browser.setUrl("...mysite.html");
>> browser.execute("helloWorld();");
>> ...
>>
>> mysite.html
>>
>> <html>
>> ...
>> <body>
>> ...
>> <script type="text/javascript">
>> function helloWorld(){
>> alert("hello world!");
>> }
>> </script>
>> </body>
>> </html>
>>
>
Re: swt browser.execute(javascript) problem [message #554631 is a reply to message #554188] Mon, 23 August 2010 14:52 Go to previous message
Eclipse UserFriend
Originally posted by: xuesong.wen.gmail.com

Tom Schindl 写道:
> You could try to add a progress listener and call the method when the
> page loading is completed.
>
> Tom
>
> Am 20.08.10 15:06, schrieb Tom Schindl:
>> Because the page loading in the browser happens in an async fashion (the
>> ui thread is not blocked) and the page is not loaded yet when you call
>> the method.
>>
>> Tom
>>
>> Am 20.08.10 14:39, schrieb xuesong wen:
>>> Hello, I have a question about browser.execute() method.
>>>
>>> why browser.execute("hello world();") can not be sucessfully executed in
>>> UI thread?
>>>
>>> code:
>>> ...
>>> browser.setUrl("...mysite.html");
>>> browser.execute("helloWorld();");
>>> ...
>>>
>>> mysite.html
>>>
>>> <html>
>>> ...
>>> <body>
>>> ...
>>> <script type="text/javascript">
>>> function helloWorld(){
>>> alert("hello world!");
>>> }
>>> </script>
>>> </body>
>>> </html>
>>>
>
Hi Tom, thanks for your response! :)
Previous Topic:Browser.evaluate() always return null on Ubuntu 10.04
Next Topic:Forcr UI update
Goto Forum:
  


Current Time: Wed Jul 23 11:02:32 EDT 2025

Powered by FUDForum. Page generated in 0.06959 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top