Alex
Alex

Reputation: 169

Iframe doesnt work

Thanks for the information about header troubles. One more question: Can i know if there are header issues preventing me show it in an iframe just from the link itself? So i will show a different page for the problematic sites?

I have a page where i include another website. The code is:

<iframe id="frameId" WIDTH="100%" HEIGHT="80%" src="<?php echo $deal_URL ?>">Cant open the iframe</iframe>

The problem is that sometimes the iframe is not shown on the page. I inspect it with chrome "inspect element" and i have found out that between the tags

<iframe> </iframe>

I also have html.

<iframe id="frameId" WIDTH="100%" HEIGHT="80%" src="<?php echo $deal_URL ?>">
#document
<html>....</html>
</iframe>

Mostly it happens with amazon links.

How i can present their site? Is there other solution than iframe?

Tried solution: I tried John solution and created another php file. My original file looks:

<iframe id="frameId" WIDTH="100%" HEIGHT="80%" src='PresentFrame.php?URL=<?php echo     $deal_URL ?>'> Cant open the iframe</iframe>

And in new PresentFrame.php i wrote:

<?php  
$URL=$_GET['URL'];
echo file_get_contents("$URL");
?>

It works as in : presents some info but now it looks very bad. Pictures are not presented and it doesnt look like a website

Upvotes: 1

Views: 1138

Answers (2)

Anders Kristoffersson
Anders Kristoffersson

Reputation: 377

Do you have something in the $deal_URL every time?

And you should not use uppercase on the attributes...

<iframe id="frameId" width="100%" height="80%" src="<?php echo $deal_URL ?>">

Upvotes: 0

John Conde
John Conde

Reputation: 219794

Amazon uses the X-Frame-Options: SAMEORIGIN HTTP header which tells browsers not to allow its pages to be served in frames. Your only other option is to load the data server side (file_get_contents()) and then passthru the contents.

Upvotes: 3

Related Questions