none
Silverlight 5 with java scripts

    Question

  • hi , 

    With silverlight 4 it was not possible to add the javascript file as an embadded resource to the xap , so I would like to know if it is possible to do with silverlight 5 , if so please share some information .

    thanks.

    Wednesday, February 22, 2012 6:49 AM

Answers

  • I don't see how that could be done.  Hopefully, someone else has an idea.  Sounds a little bit of a security risk, but maybe not. 

    I think it ends up that the html/browser has to know about the javascript since that is where it is executed and I doubt there is a way for html/browser to know about javascript embedded in the XAP.   MAYBE you could get javascript out of resource in the xap and find a Div through DOM and then add children there with the javascript contents.  But it would be a stretch.

    Thursday, February 23, 2012 6:12 AM

All replies

  • Hi,

    What are you trying to do?

    Wednesday, February 22, 2012 7:11 AM
  • Seems an odd request.  If you are wanting to execute some javascript from your code, you can use the HTML Bridge.

    Google reveals:

    http://msdn.microsoft.com/en-us/library/cc645076%28v=vs.95%29.aspx

    Wednesday, February 22, 2012 7:27 AM
  • hi ,

    we have a web framework developed in silverlight and develop separate modules as xap files and the web framework runs the xap, so now we have to develop a module that uses the google map which needs separate java script files , so we have to put this file also in to the xap because we cannot keep this java script file in the frame work since it is not used by all modules.

    this is the reason why I asked about a way of having embadded java script files in the xap and get executed .

    thanks.

    Wednesday, February 22, 2012 11:42 PM
  • I don't see how that could be done.  Hopefully, someone else has an idea.  Sounds a little bit of a security risk, but maybe not. 

    I think it ends up that the html/browser has to know about the javascript since that is where it is executed and I doubt there is a way for html/browser to know about javascript embedded in the XAP.   MAYBE you could get javascript out of resource in the xap and find a Div through DOM and then add children there with the javascript contents.  But it would be a stretch.

    Thursday, February 23, 2012 6:12 AM