locked
Use iframe to open website

    Question

  • I've tried to use iframe to open an Url in windows app built with WinJS.

    The problem is that, in this page there're several links with target=_blank. When these links are clicked, the default web browser is opened when no sandbox attributes in iframe, or nothing happens when I set sandbox with any value(I've tried allow-scripts, allow-popups, allow-forms, allow-same-origin). But my purpose is that all links could be displayed in iframe in app. What's more, there's some file downloading links which need to be disabled.

    There's no way to modify the content in the iframe for security.

    I've tried to use WinJS.xhr to request the HTML and save it as a local file which could be referenced by iframe. But some pieces of js code in the page modifying innerHTML is denied also for security reason.

    Is there any way to solve this problem? Thank you for your attention.

    Wednesday, February 19, 2014 3:22 AM

Answers

  • Hi Polaris, 

    May I know if you are working with win8.1 app or win8.0 app?

    If you are working with Win8.1 App, you could use x-ms-webview in your page where you could inject script and remove all the target=blank, also disable some links. 

    But if you are working with win8.0 app, I think this might be a limit.

    --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.

    Wednesday, February 19, 2014 4:02 PM
    Moderator

All replies

  • Hi Polaris, 

    May I know if you are working with win8.1 app or win8.0 app?

    If you are working with Win8.1 App, you could use x-ms-webview in your page where you could inject script and remove all the target=blank, also disable some links. 

    But if you are working with win8.0 app, I think this might be a limit.

    --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.

    Wednesday, February 19, 2014 4:02 PM
    Moderator
  • Thank you for you reply. I'm working with Win8.0 App. 
    Thursday, February 20, 2014 6:39 AM