Search code examples
asp.net-mvciframefacebook-iframe

How do I get the Browser languages from a page that is in an iframe?


I can use Request.UserLanguages to get the Browser languages within a page, however if that page is then within an iFrame, it seems there is no languages? how do I get this information from the parent iFrame?

This iframe is in fact a Facebook iFrame app.


Solution

  • You will only be able to query info about the page if it is on the same domain and page calling the i-frame, due to cross domain security.

    "The fact that the i-frame is controlled by Facebook you will not be able to XSS."

    http://en.wikipedia.org/wiki/Cross-site_scripting

    if you control the i-frame, and it is php you can expose the document "at your own risk" add this snippet to the top of your php document before all other code.

    <?php
    header('Access-Control-Allow-Origin: *');
    ?>
    

    then you can proceed to get information with JavaScript as you normally would.