Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » swt browser.execute(javascript) problem
swt browser.execute(javascript) problem [message #554177] Fri, 20 August 2010 12: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 13:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6512
Registered: July 2009
Senior Member
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 13:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6512
Registered: July 2009
Senior Member
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 18: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: Mon Dec 09 18:18:19 GMT 2019

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

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

Back to the top