Iframes not working

I am trying to get iframes to work. I run a safari, so it is compatible, but when I test it, it becomes empty. The code:

<iframe src="http://www.google.com" width="100%" height="300">

<p>Your browser does not support iframes.</p>

</iframe>

I took the code directly from the w3schools website after using the "try it out" editor, so I know that it should work. When I changed a page from a page in their subdirectory to an external page, it appears blank.

+6
source share
2 answers

The syntax is correct. This is not your fault. Google blocks iframing using the X-Frame-Options header, which is used by newer browsers.

Possible workarounds are explained in this post on the Google forum.

+14
source

Follow the instructions on the following Google developer site in the "IFrame Deploys Using the IFrame Player API" section: https://developers.google.com/youtube/player_parameters

JavaScript code is used to watch youtube videos.

Here's a link with a more general instruction https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player

+1
source

Source: https://habr.com/ru/post/900387/


All Articles