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, 2020 in PHP by kartik
• 37,520 points
1,329 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, 2020 by Niroj
• 82,840 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, 2020 in PHP by I Navin
• 220 points
5,089 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, 2020 in PHP by manish
2,356 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, 2020 in PHP by Niroj
• 82,840 points
3,618 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, 2020 in PHP by Niroj
• 82,840 points
3,000 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, 2020 in Laravel by Niroj
• 82,840 points
23,004 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,985 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,911 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, 2020 in Laravel by Niroj
• 82,840 points
44,586 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, 2020 in PHP by Niroj
• 82,840 points
8,992 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, 2020 in PHP by Niroj
• 82,840 points
1,642 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP