EvilZone

Programming and Scripting => Web Oriented Coding => : DeXtreme April 26, 2013, 06:39:13 PM

: iFrame workaround
: DeXtreme April 26, 2013, 06:39:13 PM
I've been trying to embed external webpages in my webpage but the iFrame ends up blank. Tried with the object tag and embed tag but had the same result.I did some research and found out that some pages send "Deny" response when you try to iFrame them. So i ask you gentlemen if there is a workaround for this problem..
: Re: iFrame workaround
: vezzy April 26, 2013, 11:22:50 PM
Try a modal window library, such as Lightbox. Of course this will end up overlaying the web page, but you can modify it to be less of an obtrusion.
: Re: iFrame workaround
: DeXtreme April 27, 2013, 02:40:09 AM
Thanks a lot.i'll be sure to read about it but is this the only alternative?
: Re: iFrame workaround
: Uriah April 27, 2013, 07:59:44 AM
I have little knowledge on this, but check out php file_read_contents and readfile().
: Re: iFrame workaround
: DeXtreme April 27, 2013, 02:48:50 PM
Thanks..will do
: Re: iFrame workaround
: Fur April 27, 2013, 03:22:45 PM
Presuming you're using PHP, do something like this in your script:
: (PHP)

if(!empty($_GET['get_page'])) {
   if(!filter_var($_GET['get_page'], FILTER_VALIDATE_URL)) {
      // Not a URL.
      exit;
   }
    $page = file_get_contents($_GET['get_page']);
    if($page === false) {
        die('Page request filed.');
    }


    echo file_get_contents($_GET['get_page']);
}
Make sure you have set "allow_url_fopen" to 1 in your PHP config.


Then just call "whatever_page_you_put_the_code_in.php?get_page=http://blah.com/blah.php" instead of the website.
Just note that some websites forbid visitors who have no UA from accessing the site, and this can be easily abused as it is pretty much a proxy.


Might not work, but it's worth a try.
: Re: iFrame workaround
: DeXtreme April 27, 2013, 04:22:45 PM
Thank you very much but i'm not really conversant with PHP. Do you happen to know a sloution in javascript?
: Re: iFrame workaround
: Fur April 27, 2013, 06:28:59 PM
Thank you very much but i'm not really conversant with PHP. Do you happen to know a sloution in javascript?
Not that I know of.
http://en.wikipedia.org/wiki/Same_origin_policy (http://en.wikipedia.org/wiki/Same_origin_policy)


Alternatively, you could use Java or Flash to display the page.