How to redirect a google blog page....unless it is being contained in an iframe?

174 views Asked by At

So I have a google blog page which I would like to redirect to my page which I have an iframe of my google blog page. When I put the following code in, it redirects to my page containing the iframe:

<head>
<meta http-equiv="refresh" content="0;url=//mysite.com"/>

However obviously, in the iframe it continuously redirects and just fills up the page with the iterating header.

I found many ways to test if a page is being loaded in a browser or an iframe (such as this solution: How to identify if a webpage is being loaded inside an iframe or directly into the browser window?) however they all use javascript or script tags which Blogger does not seem to support (it refuses to save changes). Is there a way to do this test just using HTML?

1

There are 1 answers

0
Paul Sweatte On

No. But the web server can detect it via the existence of a referrer string. Here is one way to do it in an Apache .htaccess file:

SetEnvIf Referer ^http remote

<FilesMatch "\.(html|xml)">
  order deny,allow
  deny from env=remote
  allow from all
</FilesMatch>

References