edusis / open-webkit-sharp

Automatically exported from code.google.com/p/open-webkit-sharp
GNU Lesser General Public License v3.0
1 stars 1 forks source link

Invoking JavaScript #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not Implemented Exception is thrown when invoking a JavaScript

Steps to re-create:
1. Create a Windows Form Application (.net 4)
2. Add a WebKitBrowser to the form
3. Run application and browse to test page
4. Call test page JavaScript function with 
browser.Document.InvokeScriptMethod("functionName")

Version information:
 - OS:          Windows 7 Ultimate x64
 - IDE:         Visual Studio 2010 Professional
 - OWKS:        1.9 (and lower)
 - Language:    C#
 - .NET:        4.0 (Full)
 - Project:     Windows Forms Application
 - Target CPU:  x86

Additional information:
How JavaScript is called doesn't actually matter. I only need to be able to 
call JavaScript functions from C# and pass arguments (strings) to them. I also 
tried browser.Navigate("javascript:functionName()") but that trick doesn't seem 
to work.

Thanks

Original issue reported on code.google.com by icelizz...@gmail.com on 20 Oct 2011 at 7:58

GoogleCodeExporter commented 9 years ago
As you can see from the WebKit's source, callWebScriptMethod (which is behind 
InvokeScriptMethod) is not implemented in the latest webkit since it returns 
ASSERT E_NOTIMPL. For Version 2.0 I will try to write a wrapper around the 
JavaScriptCore and give you the ability to evaluate scripts, execute script 
methods and more... This will take time though and I am not pretty sure that I 
can write such a wrapper in less than a month.

Original comment by tsumalis96@gmail.com on 21 Oct 2011 at 11:12

GoogleCodeExporter commented 9 years ago
Thanks for the feedback. Since it doesn't sound like JavaScript is going to be 
an easy fix, I'll try looking for an alternative solution. In the meantime, 
keep up the good work. OWP is an impressive project and I wouldn't have 
believed how good it was if I hadn't used it myself.

Original comment by icelizz...@gmail.com on 25 Oct 2011 at 5:48

GoogleCodeExporter commented 9 years ago
Actually, the JavaScriptCore could do what you are trying to do, and I am 
trying to wrapp it in some way for version 2.0, so OWS might provide full JS 
handling.

Original comment by tsumalis96@gmail.com on 26 Oct 2011 at 12:28

GoogleCodeExporter commented 9 years ago
I just wonder what the status of this issue.
My entire project is based on ability to access javascript engine and be able 
to run scripts...I already embedded webkitBrowser in my app.... and I wonder if 
this issue was ever fixed (I see your projection for a fix was for v2.0 and now 
I see that the version is 2.3)

Original comment by leonthea...@gmail.com on 13 Dec 2011 at 5:40

GoogleCodeExporter commented 9 years ago
Unfortunately I didn't manage to build a C# <> JS bridge but I have a project 
on the way that may succeed. My main target now is making print work and then I 
will work on invoking js

Original comment by tsumalis96@gmail.com on 14 Dec 2011 at 3:28

GoogleCodeExporter commented 9 years ago
I have successfully used JScore with OpenWebKitSharp and now you can call JS 
functions when 2.4 is released. I predict that this will be in the Weekend or 
maybe after Christmas

Original comment by tsumalis96@gmail.com on 20 Dec 2011 at 4:43

GoogleCodeExporter commented 9 years ago
r111 supports invoking JS functions

Original comment by tsumalis96@gmail.com on 30 Dec 2011 at 11:23