views:

374

answers:

1

I have been developing a silverlight page using just xaml, javascript and html (I literally only have a .html, .js and .xaml file). The problem is, I just realized that it isn't working in any browser EXCEPT Internet Explorer (7 for sure).

I have too many lines of code to want to add vb.net or visual c code behind and use the html bridge. I just want the xaml mouse events to work directly as before. In other words, when the xaml's MouseLeftButtonDown says "highlightMe" I want that highlightMe function to be a javascript function. But I also want my page to work in any browser.

Now, I've played around with creating a brand new visual studio project with vb.net or visual c.net but the xaml file events seem to point to code behind events. Also, it compiles the silverlight into a .XAP file. The XAP file is actually a .ZIP file with a compiled dll and an appmanifest.xaml.

So, how do I configure my appManifest.xaml to handle a silverlight page that has only javascript and xaml (and an html file pointing to the .XAP as the source). The html part, I THINK I understand. AppManifest is a different story and I definitely need help with that one.

I think it has something to do with creating an app.xaml and page.xaml and using the x:Class value of the main tag.

A: 

Since I asked this question I found a page...

http://pagebrooks.com/archive/2009/02/19/custom-loading-screens-in-silverlight.aspx

...that 1) showed people recently using a similar model of .js, .xaml and .html for their silverlight page and 2) someone in the comments recommended using firebug to track down issues with silverlight javascript errors.

This proved to me it's ok to use this model of silverlight and that it should work in other browsers. This also made me go try firebug. Firebug is AWESOME. If you enable the console tab, you can see exactly where the javascript was hanging up. And now that it's working, I can see the result of my gets/posts to google app engine.

Firebug showed that I was using if then else statements in a way that only internet explorer allows. For example,

if (blah == 1) { blah2 = 3}

else { blah2 = 5};

works in every browser, but this doesn't:

if (blah == 1) { blah2 = 3} ;

else { blah2 = 5};

Firefox and chrome and safari all apparently need there to NOT be a ; end statement character between the else and if.

So, for the moment, I appear to have fixed my problem with cross-browser compatibility, but I'd still like to know more about appmanifest.xaml and how to make a .xap file with only javascript. I might need it later.

Neo42
there should never be a comma after a '}' of an if/else/try/catch...
geowa4
this thing called chiron might help.http://blog.jimmy.schementi.com/2008/05/story-of-ruby-and-python-in-silverlight.html
Neo42