Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Block Iframe call

Tags:

Recently my complete site is called in iframe by two other domains. I would like to block other sites, who are trying to show my site in iframe.

How can i block that through .htaccess?

like image 878
user737665 Avatar asked May 04 '11 09:05

user737665


People also ask

Can IFrames be blocked?

IFrames are also used to show pop-under ads and to set cookies on your computer that survive even after you clear cookies from your browser. To prevent misuses of iFrames, you can block them from websites using the security parameters for Internet Explorer or Firefox, and with a plugin for Google Chrome.

How do I fix refused connection in iframe?

You cannot fix this from Power Apps Portal side. Most probably web site that you try to embed as an iframe doesn't allow to be embedded. You need to update X-Frame-Options on the website that you are trying to embed to allow your Power Apps Portal (if you have control over that website).


1 Answers

You can set the variable in the header X-Frame-Options: Deny.

All modern browsers support the X-Frame-Options header.

The Facebook uses this header to disable iframe/framesets (also Javascript).

If you have enabled the mod_headers in apache:

.htaccess

Header set X-Frame-Options DENY 

But, you can enable iframes come from the same origin.

Header always append X-Frame-Options SAMEORIGIN 

Or in Nginx:

add_header X-Frame-Options Deny; #or SAMEORIGIN 

Browser compatibility: Source

  • Internet Explorer: 8.0
  • Firefox (Gecko): 3.6.9 (1.9.2.9)
  • Opera: 10.50
  • Safari: 4.0
  • Chrome: 4.1.249.1042
like image 158
Dg Jacquard Avatar answered Nov 15 '22 15:11

Dg Jacquard