Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread querying if an interface is supported by the browser
Fri, Dec 6 2013 12:05 PMPermanent Link

Leslie

Tim,

if (SomeInterface in  window) {   }

should be the proper JS  way  to query if an interface is supported by the browser.  

What would be the proper way in EWB to do that?

A more sepcific question regarding IE:

v10+ definitely supports WebSocket. This online checker properly signals that it is supported: http://jimbergman.net/websocket-web-browser-test/  . Yet  WebSocket is undefined for IE if you try to use it from EWB. I have created the WebSocket interface for EWB and it is working fine with all the other browsers. It is just IE I have problem with. Even  when the very  same JS code  the online checker is using is imported as an external function to check if WebSocket is supported it remains undefiend for IE as long the EWB app is concerned.

Cheers,
Leslie
Mon, Dec 9 2013 6:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Leslie,

<< if (SomeInterface in  window) {   }

should be the proper JS  way  to query if an interface is supported by the
browser.

What would be the proper way in EWB to do that? >>

JS doesn't have "interfaces" exactly, and what you're doing is simply
checking for a (constructor) function in a key/value array (JS object).  EWB
doesn't support this because it doesn't expose the built-in web browser JS
classes in the same way.  If you want to check for the existence of an
object property, then you simply need to make sure that the property exists
in the external interface (WebDOM) and that it isn't nil.  You can see how
this works with the local storage class in the WebCore unit.

<< v10+ definitely supports WebSocket. This online checker properly signals
that it is supported: http://jimbergman.net/websocket-web-browser-test/  .
Yet  WebSocket is undefined for IE if you try to use it from EWB. I have
created the WebSocket interface for EWB and it is working fine with all the
other browsers. It is just IE I have problem with. Even  when the very  same
JS code  the online checker is using is imported as an external function to
check if WebSocket is supported it remains undefiend for IE as long the EWB
app is concerned. >>

EWB forces the IE version of the HTML to either IE9 (HTML5) or IE8, so if
something requires IE10, then it won't be "visible" due to the forced
versioning.  You can modify the outputted HTML to change this for now, but
EWB 2.0 won't have this forced IE versioning anymore because we'll be
dropping IE8 support then.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Dec 9 2013 6:52 PMPermanent Link

Leslie

"JS doesn't have "interfaces" exactly"

What I meant is that window.WebSocket functionally is  sort of an interface to WebSocket API of the browser.

Cheers,
Leslie
Image