python-3.xgtk3webkit2

how to set X-Frame-Options for local file


I create a web browser in python3 with pygobject (gtk3 and webkit2) and I want create a home page include google. I create a html file with a iframe but I see the error :

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

How I can set X-Frame-Options ? All the solution in the web is a configuration in a local serveur but I don't have local serveur.

Here is my home page

<!DOCTYPE html>
<html>
   <head>
       <title>(Nouvelle page)</title>
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
   	<iframe src="https://www.google.com/"></iframe>
   </body>
</html>


Solution

  • This is not something you can fix locally, unfortunately.

    There is a similar question here: https://stackoverflow.com/a/8700754/2773979

    The problem isn't that your page is missing that header, it is that Google sets this header precisely to prevent people from embedding the site into an iframe. Browsers comply to this by refusing to load/display the content of the iframe.

    Note that there are solutions, like proxying the google page, but those are probably against the terms of service.