Silverlight has a more natural support of JavaScript.

It was interesting to read this 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.


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:


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 (6)

  1. AjaxDemon says:

    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;}

  2. Garry Trinder says:

    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)

  3. TJ Downes says:

    As someone who is using both technologies I can tell you that SilverLight has its good and bad points, as does Flex.

    Interoperability with AJAX applications, even through the use of ExternalInterface, isn’t difficult. Sure, it’s a bit of a hack, but I expect this to get easier. After all, Adobe has been doing this in AIR long before SilverLight. What we are finding is that both Flex and SilverLight are decent RIA platforms, but Flex has a lot more going for it at the moment. I suspect this is solely due to the maturity of the platform. We really hope MS continues to improve SilverLight, assisting in the evolution of the RIA Platform. However, we think it’s really silly that the folks at MS continually (especially you Scott) dig on other platforms to try to make yours look better. Can’t you just prove to us that it’s better by releasing a great product?

  4. Garry Trinder says:


    I never stated that Flash ExternalInterface is difficult, just implied it was a cumbersome approach. As Silverlight provides direct access to it’s own internal "DOM" if you will. Thus, it’s a more natural fit.

    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. It’s had a lot of reactive decision making in it’s entire life cycle (look at Gumbo which is a release to right a lot of wrongs), It’s had various iterations and business decisions that has likely cost it the success it was scheduled to have and not to mention that the size of the market is still relatively small compared to Silverlight today (eg: 10,000 on FlexCoders, 36,000 on Silverlight.NET Forums as a basic public example).

    Flex has it’s positive attributes, but I’d disagree that it’s a mature technology.

    As for digging? *shrug* Adobe do it almost daily and get away with it, I do it every now and then and get pinned for it. I guess it’s a case of "eye of the beholder" maybe?

    My "digg" wasn’t to one-up Adobe, but to distance ourselves from Adobe as whilst Adobe are playing catchup to the notion that AJAX is still important, we on the otherhand have made efforts to ensure that Silverlight compliments AJAX as best we possibly can.

    Adobe AIR / Apollo haven’t been doing it longer than Silverlight, as WPF/E was purely about JavaScript + XAML? Secondly, out of all the AIR buzz, I’m yet to see an actual AJAX + AIR solution in the mainstream "twitter" camps etc.

    Got any examples or case studies?

    As for proving our worth, depends on what you think success looks like is more my response to this.


  5. TJ Downes says:

    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 😀

  6. Garry Trinder says:

    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?