Share via


Hosting Silverlight On A Server That Won't Host .JS Files

Torontonian "wavesmash" has been tinkering with getting a Silverlight app up and running on his Blogger blog.  Silverlight Streaming got him most of the way there, but he found the recommended pattern of placing the Silverlight control construction in a separate createSilverlight.js file became a show stopper because Blogger won't let you serve .js files from their domain (and for good reason).

What to do? What to do?  Copy the content of createSilverlight.js into a script block in your HTML, of course.

The createSilverlight.js pattern is just that:  a recommended pattern.  There are dozens of ways to slice and dice the construction of the Silverlight control.  The createSilverlight.js pattern was anointed with recommended status over other techniques because it was considered easier to approach and explain.   

"It's only a model!"

Comments

  • Anonymous
    May 27, 2007
    interesting...

  • Anonymous
    May 28, 2007
    Do you think is it possible for the Silverlight streaming server to host the js file or would this throw a security error?

  • Anonymous
    May 28, 2007
    Hi wavesmash, Short answer:  I think you can, but haven't tried it myself. Long answer:  You'll need to do some digging, to wit: JS files can be loaded across domain boundaries, so there shouldn't be any issue with that.  The content being served by Silverlight Streaming is coming into your browser via plain old HTTP.  The tricky party will be figuring out what URL to use to reference your .JS file in your Silverlight Streaming storage area.  I suggest using an HTTP packet inspector such as Fiddler to see what URLs go across the wire for your particular Silverlight Streaming app, and then try using that URL as the basis for referencing your JavaScript on Silverlight Streaming from your main HTML page.  The URL may be obscure, but it should be stable. Keep in mind that Silverlight Streaming isn't intended to host JavaScript for non-Silverlight apps, so it's not great surprise that coercing it to do this will require some additional work on your part. -Danny