0

I really tried to find an answer but couldn't. Google have changed their Autoplay Policy .

I am loading an iframe with Src to independent code, like this:

<iframe frameBorder="0" scrolling="no" allow="autoplay"
src="myurl" 
 width="640" height="480">
</iframe>

myurl is a path the a video player. I want to check if 'allow="autoplay"' was passed as iframe attribute where the player code is, and the decide if to set auto play or not.

Note, that the site where the iframe is loaded is a different site' with different code and it even sites on a different server then the myurl site.

How can I do it?

Hellpless
  • 68
  • 10
  • Possible duplicate of [SecurityError: Blocked a frame with origin from accessing a cross-origin frame](https://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame) – tjadli May 16 '18 at 10:12
  • So there is no other way to know if allow="autoplay" was set then to ask the other site programmer to post a massage? It feels like a very complicated solution. Are you sure there is no other way? I don't want to change the attr, only to check it. – Hellpless May 16 '18 at 10:40
  • I am sure about interacting with the iframe, but just checking it, i am not sure,you can test it out ! – tjadli May 16 '18 at 11:15
  • Lol! If I knew how I wouldn't post this question. Maybe someone will know. – Hellpless May 16 '18 at 11:30
  • It actually depends on your url you want to load in the iframe, if you have control over it or not? – tjadli May 16 '18 at 11:38
  • and yeah it's actually possible with something like : $("#iframe").contents().find("#content") – tjadli May 16 '18 at 11:49

1 Answers1

0

It can not been done. You need to use a promises to check if the auto play succeeded. I used googles way of doing it.

Hope it will saves some time to someone :)

Hellpless
  • 68
  • 10