Support » Fixing WordPress » Framed site not displaying

Viewing 10 replies - 1 through 10 (of 10 total)
  • this works for me (hard editing php files):
    <iframe width="800" height="400" src="http://www.nytimes.com"></iframe>

    but amazon doesnt embed.. some sites can block using JS frame-options or by .htaccess.

    Thread Starter kravinec

    (@kravinec)

    I used the exact same pattern and it’s not working. But it probably won’t be Amazon specific issue, because other sites behave the same.

    are you using X-Frame-Options?
    which server – nginx/apache?
    development or production system?
    browser? did you check with different browser? maybe even different pc if possible.
    do you have access to log file? are headers being sent twice?
    if you are using frame-options then make sure you use it only one and the right one.
    Edit:
    also share your code block, with the containers and all for the iframe embed code.
    hope you are not using any visibility: hidden or display: none css settings for iframes in your code. or any plugins doing it.

    PS: this aint exactly a wordpress question. tried stackoverflow or similar? (admins do moderate if unappropriate to quote external site).

    Thread Starter kravinec

    (@kravinec)

    I don’t know if I’m using X-Frame-Options. Server is Apache: I use Chrome, but Firefox behaves the same. I don’t believe I can see any log, no.
    The code till the end of footer.php:

    do_action( ‘influence_credits’ );
    echo $credits;
    ?>
    </div><!– .site-info –>
    <?php endif; ?>

    <iframe sandbox allow-same-origin src=”http://www.amazon.com/gp/product/B00EJOCAYW/ref=as_li_qf_br_asin_il_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00EJOCAYW&linkCode=as2&tag=ebolapreventi-20&linkId=4QTCF54SZCH36A5O&#8221; name=”test” height=”100″ width=”100″> </iframe>

    </div>
    </footer><!– #colophon .site-footer –>
    </div><!– #page .hfeed .site –>

    <?php get_sidebar(‘menu’) ?>

    <?php wp_footer(); ?>

    </body>
    </html>

    the sandbox="allow-same-origin" is actually same as x-frame-options. read about it here. so you are better off removing that property.

    honestly, if you had copy-pasted my above code as is and tested then you would have reached this conclusion earlier: <iframe width="500" height="500" src="http://www.nytimes.com"></iframe>.

    and again, amazon cannot be embedded in iframe AFAIK, most probably because they have htaccess restricts set for it.

    cheers..

    PS: please mark thread as closed and resolved if ok with you.

    Thread Starter kravinec

    (@kravinec)

    Oh, but there must be other ways to embedd the site… When experimenting with “$site = file_get_contents” I think I once got the site content to load, but it wasn’t in frame and trying to get it in frame resulted in failure again and I couldn’t get it to work again. Do you know how to make it work this way and to set the size? Thanks.

    actually if thats what you want then its easy.
    use: <?php echo file_get_contents('http://www.amazon.com'); ?>.
    alternate ways are with using objects, cURL, Ajax or link in html5.

    for resizing just set dimensions and scroll overflows.
    heres a standalone dummy code for understanding:

    <?php
     /* */
    ?><!DOCTYPE html>
    <html>
    <head>
    	<title>Check Embed</title>
    	<style type="text/css">
    	.scale {
    		width: 500px;
    		height: 500px;
    		margin: 0 auto;
    		overflow: scroll;
    	}
    	</style>
    </head>
    <body>
    	<div class="scale">
    		<?php echo file_get_contents('http://www.amazon.com'); ?>
    	</div>
    </body>
    </html>

    hope you get the idea.

    PS: embedding other websites without permission may result in copyright issues, etc. am just helping you code. but do be aware of issues in doing so. just sayin..

    Thread Starter kravinec

    (@kravinec)

    OMG, thanks a lot! It works now. One last thing: Is there a code to stop pictures, css and Javascripts from loading on the embedded site?

    heres an adhoc code which will strip javascripts and load:

    <?php
     /* */
    ?><!DOCTYPE html>
    <html>
    <head>
    	<title>Check Embed</title>
    	<style type="text/css">
    	.scale {
    		width: 500px; height: 500px;
    		margin: 0 auto; overflow: scroll;
    	}
    	</style>
    </head>
    <body>
    	<div class="scale">
    		<?php
    		$goofygoo = file_get_contents('http://www.amazon.com');
    
    		$startgoofy = strpos($goofygoo,"<script");
    		$endgoofy = strpos($goofygoo,"</script>");
    		$endgoofy += 9; //remove </script> tag - 9 chars
    		while ($startgoofy && $endgoofy) {
    			$goofylen = $endgoofy - $startgoofy;
    			$goofygoo = substr_replace($goofygoo, '', $startgoofy, $goofylen);
    			$startgoofy = strpos($goofygoo,"<script");
    			$endgoofy = strpos($goofygoo,"</script>");
    			$endgoofy += 9; //remove </script> tag tag - 9 chars
    		}
    
    		echo $goofygoo;
    		?>
    	</div>
    </body>
    </html>

    images dont have closing tags and css <link rel.. doesnt have closing but <style> tag does. you can implement likewise.

    anyways we have solved the purpose of this thread i feel. you can mark this thread as solved and close it and open a new one for requests.

    Thread Starter kravinec

    (@kravinec)

    Thanks a lot, man.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Framed site not displaying’ is closed to new replies.