How to prevent my site page to be loaded via 3rd party site frame of iFrame?

0 votes
How can I find out that my page is embedded as a frame to other site during page loading? I guess referrer request header can't help me here?
Oct 19 in PHP by kartik
• 35,300 points
18 views

1 answer to this question.

0 votes

Hello @kartik,

You cannot check it from the server's side, but you can use javascript to detect it after the page has loaded. Compare top and self, if they're not identical, you are in a frame.

Additionally, some modern browsers respect the X-FRAME-OPTIONS header, that can have two values:

  • DENY – prevents the page from being rendered if it is contained in a frame
  • SAMEORIGIN – same as above, unless the page belongs to the same domain as the top-level frameset holder.

Users include Google's Picasa, that cannot be embedded in a frame.

answered Oct 19 by Niroj
• 76,540 points

Related Questions In PHP

0 votes
1 answer

How to resolve “must be an instance of string, string given” prior to PHP 7?

Hello, Prior to PHP 7 type hinting can only be ...READ MORE

answered Apr 20 in PHP by I Navin
• 220 points
663 views
0 votes
1 answer

How to validate E-mail and URL of Php form?

hey, The code below shows a simple way ...READ MORE

answered Feb 13 in PHP by manish
248 views
0 votes
1 answer

How to install a specific version of package using Composer?

Hello, Just use php composer.phar require For example : php ...READ MORE

answered Apr 1 in PHP by Niroj
• 76,540 points
927 views
0 votes
1 answer

How to merge two arrays while keeping keys instead of reindexing in php?

Hello, Considering that you have $replaced = array('1' => ...READ MORE

answered Apr 1 in PHP by Niroj
• 76,540 points
120 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18 in Laravel by Niroj
• 76,540 points
3,441 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18 in Laravel by Niroj
• 76,540 points
411 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23 in Laravel by Niroj
• 76,540 points
281 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23 in Laravel by Niroj
• 76,540 points
4,142 views
0 votes
1 answer

How to delete all cookies of my website in php?

Hello @kartik, This will unset all of the ...READ MORE

answered Oct 27 in PHP by Niroj
• 76,540 points
14 views
0 votes
1 answer

How to get thumbnail of youtube video from youtube API?

Hii @kartik, If you want the biggest image ...READ MORE

answered Apr 1 in PHP by Niroj
• 76,540 points
504 views