locked
Get silverlight frame object using javascript and call navigate function RRS feed

  • Question

  • I have a working silverlight application with hash based URL routing integrated with the browser. (Journal = Automatic[default])

    Currently, I am working on an Angular2 application, where the Silverlight application is loaded inside a component (inside a div tag - using javascript ). On the load event of the Silverlight control I can view the sender.BaseHref property. 

    The silverlight  content is bound to a Frame and navigation occurs via the Frame.Navigation() method. Is there any way that I could get the Frame object and call it via javascript?



    Rahul Lohia. Software Developer. Microsoft Technologies.

    Monday, July 4, 2016 12:01 PM

Answers

  • Hi lohiarahul,

    Thanks for your response.

    So you want to access the XAML object in Silverlight with Javascript from HTML page. Yes, we can access Silverlight object from Javascript with Javascript API for Javascript.

    Following article introduce how to make Silverlight Scriptable by JavaScript. Hope that can help you.

    https://msdn.microsoft.com/en-us/library/cc645085(v=vs.95).aspx

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 6, 2016 1:09 AM
    Moderator

All replies

  • Hi lohiarahul,

    According to your description, you want to get Frame object with Javascript and then call its Navigation() method, is it right?

    Please get the Frame object through document.getElementById() and then call the Navigation() method. And you also can use window.frames[0](access by number), which allows to access iframe window objects directly.

    Following thread introduce how to implement javascript frame navigation, which is similar with your problem. Hope it can help you.

    http://stackoverflow.com/questions/16962781/javascript-frameset-navigation

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 5, 2016 1:44 AM
    Moderator
  • With Frame I mean, a System.Windows.Controls.Frame inside the XAML. Can I get access to the Object tree created by XAML and then call a method on that? Perhaps with a name or an id on that element to access it.

    Rahul Lohia. Software Developer. Microsoft Technologies.

    Tuesday, July 5, 2016 5:11 AM
  • Hi lohiarahul,

    Thanks for your response.

    So you want to access the XAML object in Silverlight with Javascript from HTML page. Yes, we can access Silverlight object from Javascript with Javascript API for Javascript.

    Following article introduce how to make Silverlight Scriptable by JavaScript. Hope that can help you.

    https://msdn.microsoft.com/en-us/library/cc645085(v=vs.95).aspx

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 6, 2016 1:09 AM
    Moderator
  • I had to use the Silverlight to HTML bridge to accomplish what I wanted. Exposed a method that navigated through the frame and made that scriptable to be called via Javascript. Thanks.

    Rahul Lohia. Software Developer. Microsoft Technologies.

    Monday, July 18, 2016 8:11 AM