Freigeben über


Silverlight has a more natural support of JavaScript.

It was interesting to read this CNet.com article around Flash, HTML and AJAX.

It talked about the various ways in which the Adobe Flash is struggling to compete with AJAX in the RIA space. In fact, some of our early research showed that AJAX was associated with RIA, and not Flash, despite Adobe's best efforts to claim the ownership behind the acronym.

The article mentioned various pieces to the Silverlight discussion, which to me wasn't enough. In that with Silverlight enabling JavaScript interoperability is more seamless and natural than Flash has ever as been.

How?

Well you have to take a hard look at Flash.  In order to merge both Flash and AJAX solutions together, there is a degree of compromise: if you wish to allow JavaScript to get deeper access to assets within the closed binary, you first have to write a method or two via the ExternalInterface API. This is like poking holes in the runtime for JavaScript to access.

Example, Ryan Stewart @ Adobe was quoted:

We need to bring Flash and HTML/Ajax closer together. You absolutely should be able to reach inside of the Flash Player as a JavaScript developer and pull out some of the good bits that make the Flash experience so great. We shouldn’t force the “1 pixel SWF” or a sand-boxed Flex application.

Inside Silverlight, we've empowered JavaScript folks to have a more natural amount of access to the content within (without any extra proxy code API's). This can be done via our HtmlWindow Class within Silverlight itself or if you're looking to access the content from JavaScript, it's simple a matter of using the below:

document.getElementById('yourcontrolId').Content

From the .Content onwards, you now have full access to the Silverlight solution as if you were accessing the content from within C#, IronJava, IronRuby etc.

This again, illustrates how committed we are to ensuring Silverlight is an open cross-platform, cross-browser and cross-device solution for your next bet. As opposed to a closed binary format which has restrictions implied such as the External Interface API.

We don't see AJAX as competition (in fact, Outlook Web Access was one of the first AJAX applications ever built), it's more of a complimentary extension (Silverlight v1 was released with JavaScript first, before C#) than a competitor and we've made a lot of efforts around our ASP.NET AJAX Control Toolkit to ensure that it's being proven. You don't need ASP.NET to use the Control Toolkit either, as the source code is freely available for other dynamic languages to make use of.

Further, if .NET isn't your cup of tea, that's fine you can add your own dynamic language support to Silverlight, via the DLR such as the OpenSource Project that is currently working on enabling Client-Side PHP to work ontop of the DLR.

Comments

  • Anonymous
    August 13, 2008
    This is great news. Is it also possible the other way round? Can embedded SilverLight controls/widgets send events to the encapsulating Javascript in the same way that an embedded ActiveX control can have events,  e.g. onClick = function(){doSomething;}

  • Anonymous
    August 13, 2008
    Yeah, you can do that with javascript:URL if you really wanted to, but it can get messy, so no reason you can't.. that or you declare you function as string, and then evaluate(string)

  • Anonymous
    August 29, 2008
    The comment has been removed

  • Anonymous
    August 29, 2008
    The comment has been removed

  • Anonymous
    August 29, 2008
    Scott, I'm quite sure how you can even make the assumption "As someone whom has used Flex way before you were even tooling with it, I can actually testify that maturity is not what i'd throw down on Flex." as we have never met, let alone had any conversations about our experience with RIA or web application development. I recommend spending some time reviewing the AIR and Flex showcases, the stuff exists. We ourselves have developed full blown AIR/AJAX applications for clients. We aren't at liberty to share those, but I can tell you it was very easy to integrate the application with a pure AJAX application that was using JMS as the backend. We can't be the only ones doing this :D

  • Anonymous
    August 29, 2008
    I base this off the fact I was using Flex before it was even named Flex :) I've reviewed the showcases, again, point me to a mainstream solution that is using AJAX/AIR in public view so we can discuss further. Until such time, is it fair to say that your points are simply opinions being thrown around as to what you think the size of the Adobe market is vs what it actually is? Which don't get me wrong is a healthy debate to have, but at what point does this have relevance to the fact Silverlight is a more natural fit to the AJAX way of thinking - which may I add, you've not argued? Again, what's the wrong you're trying to right?