locked
Want to put content in element via ajax with youtube iframe video inside...

    Question

  • Hello there...

    I have this problem- make ajax request to our server API and this request return to me HTML code... then i want to put it in some element.

    I successfuly did it with 

    var html = toStaticHTML(data.content); and put it after with element.innerHTML(html);

    But the problem is that i have an iframe (youtube video) in this HTML code and this iframe is removed by toStaticHTML function. Is there a way to make it work?

    Thank you and sorry for my English.

    Monday, March 10, 2014 10:31 PM

Answers

  • Hi Boris,

    Iframe is not allowed in Windows Store App, take a look at: Making HTML safer: details for toStaticHTML.

    I think execUnsafeLocalFunction might be the solution for you to solve this problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Boris Delev Tuesday, March 11, 2014 9:22 AM
    Tuesday, March 11, 2014 6:03 AM
    Moderator

All replies

  • Hi Boris,

    Iframe is not allowed in Windows Store App, take a look at: Making HTML safer: details for toStaticHTML.

    I think execUnsafeLocalFunction might be the solution for you to solve this problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Boris Delev Tuesday, March 11, 2014 9:22 AM
    Tuesday, March 11, 2014 6:03 AM
    Moderator
  • Hi Jamles,

    Thanks for respond... is it not allowed? Because if i put youtube iframe in default.html (for example) - without ajax request- i can play youtube (soundclould) iframe. Maybe you mean it is not allowed when comes from ajax, right? Well... then- how Nextgen Reader app read my news and show Youtube Videos inside the app? 

    I know u cant tells me... but i cant find any example or recommendation for this. In every example they use get content from uri, not from ajax - like new WinJS.UI.HtmlControl...

    Thanks anyway.

    Tuesday, March 11, 2014 9:19 AM
  • Hi Boris,

    Iframe is not allowed in Windows Store App, take a look at: Making HTML safer: details for toStaticHTML.

    I think execUnsafeLocalFunction might be the solution for you to solve this problem.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Mate- thanks. With this execUnsafeLocalFunction  i do it! Let the power be with you. Thank you!!!
    Tuesday, March 11, 2014 9:21 AM