GoodDemo Architecture – Recording Component Part 3

1 view
Skip to first unread message

Gil Shabat (Novologies)

unread,
Apr 6, 2009, 11:16:22 AM4/6/09
to GoodDemo
In the previous post, I covered our solution to add GoodDemo’s
recording functionality on any site without forcing users to install
anything on their desktop or internet server.

In this post, I would like to cover a possible approach to overcome
our next challenge: allowing our recording code to connect with the
GoodDemo site while avoiding the cross-domain browser limitation.

After digging around in Microsoft documentation, we found a really
elegant solution: Silverlight can access any service on the same
domain, but is restricted, for security reasons, from accessing
services on external domains unless such permission is explicitly
granted by the hosting domain by configuring a custom client access
policy with the appropriate permissions (clientaccesspolicy.xml). You
can read more on this under the following link:
http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx.

As you recall our recording module (JavaScript) will be downloaded to
the same page that the user is trying to record, which would then
grant it full access (within the browser’s limitations) on that
domain. We would then execute the appropriate code and add a custom
Silverlight control to that page and use that control to both perform
recording actions on behalf of the user and to send & receive
recording data from the GoodDemo website (after allowing cross-domain
traffic on the GoodDemo website).

Given all the above I was able to validate all our assumptions except
for one – the Silverlight control only loads on the same domain it was
created on (where its xap file exists), and “refused” to load on any
external domains. After some research I found that by default
Silverlight is not granted access to the local DOM when used from an
external domain, however, we can change this if upon initialization we
set its enableHtmlAccess property to “true”. In this case it loads
properly and has full rights to the local DOM. Problem solved!

Just as a recap, here is the proposed solution for our recoding
module:

- GoodDemo would use a bookmarklet (favorite) with JavaScript to
execute code on the local page.

- The code would load a JavaScript file from GoodDemo site, which
would adjust the current user page, and would load a SilverLight
control from the GoodDemo site (setting enableHtmlAccess property to
“true” to allow this).

- The Silverlight control would monitor a user’s actions for recording
purposes and upon request would save the data to the GoodDemo site
using a WCF service that would be configured on the GoodDemo site with
no cross-domain restrictions (this would require configuring
clientaccesspolicy.xml on the site’s root folder).

I have already built a small demo demonstrating the above solution and
I’m planning to put it up on the GoodDemo site in the next few days
for everyone to comment on.

Gil
Reply all
Reply to author
Forward
0 new messages