locked
Iframes and external content

    Question

  • Hello guys.

    The docs say that you cannot load an external page into an iframe without configuring the application content URI rules. However, I've built a simple test where this behavior is only valid when you try to replace the top page with a new external URL.

    What I'd like to know is if the docs are wrong. If that isn't the case, then what is the correct behavior? Will I be able to replace the top page with an external URL if it's added  to the application content URI rules in the manifest? Do I also need to add that entry if I want to replace the default content of an iframe?

    btw, one more note: why can't I load localhost content? I've added a really simple HTML page to the default IIS Web site and I can open it with the browser but whenever I try to load it in an iframe, it simply doesn't get rendered...

    thanks.


    Luis Abreu

    Monday, January 2, 2012 10:13 PM

Answers

All replies

  • anyone?

    at least, any feedback on the loading a page from the localhost?


    Luis Abreu
    Wednesday, January 4, 2012 9:44 PM
  • Can you point me to the docs that you are speaking about?
    Jeff Sanders (MSFT)
    Monday, January 9, 2012 2:30 PM
    Moderator
  • Hello.

    Sorry for the late reply, but it was only today that I've went through my threads and noticed you had asked about the docs.

    The info is from the js navigation quickstarts: http://msdn.microsoft.com/en-us/library/windows/apps/hh452765.aspx

    Linking to external content

    The previous section showed how to link to a page contained within your app. You can also link to external pages—with some restrictions: you can display an external page in an iframe, but you can't navigate your top-level page to an external website.

    The next example adds a link to http://www.bing.com.

    <p><a href="ms-wwa:///page2.html" target="targetFrame">Go to page 2</a></p>
    <p><a href="http://www.bing.com" target="targetFrame" >Search the web</a></p>
    
    <iframe name="targetFrame">
    </iframe>
    
    

    When you click the second link, something interesting happens—the link opens in the web browser rather than inside your application, unlike the first link which opened inside the application. That's because the URI isn't considered part of the application's content.

    *** This does not happen in my machine. creating a new blank application and adding this markup:

    <body>
        <h1>Navegação simples</h1>
        <div><a href="pagina2.html">Navegar para página interior do pacote (susbtitui página atual)</a></div>
        <div><a href="pagina2.html" target="frame">Navegar para página interior do pacote numa iframe</a></div>
        <div><a href="http://www.record.pt">Navegar para homepage do jornal Record (substitui página atual)</a></div>
        <div><a href="http://www.record.pt" target="frame">Navegar para homepage do jornal Record na iframe</a></div>
        <iframe name="frame"></iframe>
    </body>

    Will always open the browser when I don't set the target and will open the page in the iframe when clicking over the a which targets the iframe. I haven't added any entries to the applicationcontenturirules as indicated in the docs (ie, the docs say that for the external url to be opened in the iframe, I need to add an entry to the app's manifest. I haven't done it and it works. are the docs wrong? or are the docs right?)


    Luis Abreu

    Thursday, February 16, 2012 12:14 PM
  • Moving to this thread that is addressing this question:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/b696eb9d-1c98-41eb-b9f3-8782b63ff82b


    Jeff Sanders (MSFT)

    Thursday, February 16, 2012 6:41 PM
    Moderator