Press Youtube Subscribe Form Button inside of iframe

后端 未结 2 1842
一个人的身影
一个人的身影 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: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.

提交回复
热议问题