Welcome Guest Search | Active Topics | Sign In | Register

JSNull to String Options
GarrG
Posted: Sunday, March 18, 2018 5:03:52 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2018
Posts: 1
Using the ObjectForScripting method of providing a javascript interface (which is a FANTASTIC feature. I'm just in trial mode but that may be the clincher), it doesn't seem possible to pass null Strings.

String is a nullable type in .Net, so passing null from javascript makes a lot of sense in some cases (especially since default parameters aren't likely to work). And, of course I'd like the code on our javascript end to be as consistent as possible regardless of which engine we use (WebBrowser2 control supports passing null in ObjectForScripting).

I get:
Uncaught Error: Object of type 'EO.WebBrowser.JSNull' cannot be converted to type 'System.String'.

It seems with a little Reflection any it could detect any nullable type and replace JSNull with null for that type (type.Default).
Using an object as the parameter, at least I can get the JSNull, but I was hoping to write my interface for ObjectForScripting to be unaware of the specific control (would like to fall back to WebBrowser2 if EO.WebBrowser is not installed or available). Receiving null in one case and JSNull in another is a bit odd. Values seem to work great (although I mostly pass strings) but using null from javascript is a bit odd.

Bug or feature?
eo_support
Posted: Monday, March 19, 2018 1:39:53 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Thanks for letting us know. This is an overlook on our end. We will fix this in our next build.
eo_support
Posted: Wednesday, March 21, 2018 10:34:41 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

We have posted a new build that should fix this problem. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.