Unable to iframe website

Im Unable to iframe website https://www.discountedhunts.net/ https://www.cheapelkhunts.com/
plz help

What does that mean?

1 Like

I guess its something to do with the security policy that won’t allow the page to be embedded in an iframe.

2 Likes

Hi there Atik1,

Many sites prevent their webpages being embedded in an
iframe, Google is one that comes immediately to mind. :winky:

Further rerading:-

Prevent web page from being loaded inside iFrame.

coothead

2 Likes

So whats solution

Are they both your sites and under your control?

If so change the security policy

Otherwise don’t do it :slight_smile: .

2 Likes

If PHP is available then the page content may be available with curl(…) or wget (…) and string result could be pasted into a div.

1 Like

I dont have backend access so

So don’t do it!

3 Likes

Hi there John,

would your suggestion possibly stumble over this…

<?php
   header("Content-Security-Policy: frame-ancestors 'none'")
?>

…which is shown in the link I provided in post #4 ? :wonky:

coothead

I justed tested with curl (…) and not only most surprised also very disappointed…

https://www.johns-jokes.com/downloads/sp-d/johnyboy-curl-test/?url=https://www.cheapelkhunts.com/

Further investigation

Revealed a 302 http response code redirected to a 403 http response code :frowning:

The site owners don’t want their content scraped. Surely that’s their prerogative.

The site rendered OK, copying browser right-click->view-source-code and pasting into a html file - the file renders. I am most surprised that curl(…) would not read the contents and respects the http response code.

Yes I agree that it is their prerogative.

It just seems strange the browser reveals the source code and curl(…) fails to get the content.

curl may not be faking an acceptable user-agent.

But that said, we’re entering territory I’m uncomfortable with - the site clearly does not want its content put on other sites, and scraping to circumvent the site’s otherwise enforced desires smacks of an implied TOS violation.

7 Likes

Agreed with @m_hutley above.

With that said, thread closed.

1 Like