Press Youtube Subscribe Form Button inside of iframe

后端 未结 2 1843
一个人的身影
一个人的身影 2021-01-28 18:58

I am searching how to press the Subscribe button from Youtube Subscribe Form, but I didn\'t find anything that can help me... I am new in JS, so I hope that you will help me.

相关标签:
2条回答
  • 2021-01-28 19:03

    This is impossible. The Javascript safety policies do not allow crossdomain access to the document of an embedded (i)frame.

    0 讨论(0)
  • 2021-01-28 19:25

    You won't be able to manipulate the content of an external i-frame. It is called the Same Orgin Policy. You are going to need to ask the user to click on the button.

    That would be a really bad practice to click on button without user's consent.

    --EDIT--

    If you want to subscribe the user to your channel without the user clicking on the button, read the documentation about the Youtube API on how to subscribe a user to a channel. That's your best bet.

    Hope that helps.

    0 讨论(0)
提交回复
热议问题