סקירה כללית
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הלחצן YouTube Subscribe Button מאפשר להוסיף את הלחצן Subscribe
לכל דף. הלחצן מקשר לערוץ YouTube. כשלוחצים על הכפתור, דף הערוץ ב-YouTube נפתח בחלון חדש כדי שהמשתמש יוכל לאשר את המינוי.
כדי להוסיף לחצן, האפליקציה צריכה לטעון את קובץ ה-JavaScript הזה:
https://apis.google.com/js/platform.js
אחר כך אפשר להוסיף לחצן באמצעות רכיב, כמו <div>
, שבו המאפיין class
מוגדר ל-g-ytsubscribe
, ומשתמשים במאפיינים אחרים כדי להתאים אישית את הלחצן. בדוגמה הבאה מוצגת אינטגרציה פשוטה שמציגה לחצן Subscribe
לערוץ GoogleDevelopers.
<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channel="GoogleDevelopers"></div>
אפשר גם להשתמש ב-Google+ JavaScript API כדי לעבד לחצן באופן דינמי.
אפשרויות הגדרה
הלחצנים שבהמשך מציגים אפשרויות שונות של פריסה והגדרה של לחצני הרשמה. הכפתורים לערוצים רגילים מוצגים עם מספר המנויים וללא מספר המנויים.
שפת הלחצן מוגדרת כברירת מחדל לפי הגדרות השפה של המשתמש, או לפי המיקום של המשתמשים שלא מחוברים לחשבון.
ערוצים רגילים
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-21 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-21 (שעון UTC)."],[],[],null,["# Overview\n\nThe YouTube Subscribe Button lets you add a `Subscribe` button to any page. The button links to a YouTube channel. Upon clicking the button, the YouTube channel page opens in a new window so that the user can confirm the subscription.\n\nTo add a button, your application needs to load this JavaScript file: \n\n```\nhttps://apis.google.com/js/platform.js\n```\n\nYou can then add a button by using an element, such as a `\u003cdiv\u003e`, that sets its `class` to `g-ytsubscribe` and uses other attributes to customize the button. The following code shows a simple integration that displays a `Subscribe` button for the GoogleDevelopers channel. \n\n```\n\u003cscript src=\"https://apis.google.com/js/platform.js\"\u003e\u003c/script\u003e\n\u003cdiv class=\"g-ytsubscribe\" data-channel=\"GoogleDevelopers\"\u003e\u003c/div\u003e\n```\n\nYou can also use the [Google+ JavaScript API](/+/web/api/javascript) to render a button dynamically.\n\nConfiguration options\n---------------------\n\nThe buttons below show different layout and configuration options for subscription buttons. Buttons for standard channels are shown with and without subscriber counts.\n\nThe button language defaults to the user's language settings or is set based on the user's location for logged-out users.\n\n### Standard channels\n\n| Buttons ||\n|-------------------------------|---|\n| Default button | |\n| Default button | |\n| Full layout (includes avatar) | |\n| Full layout (includes avatar) | |\n| Full layout, dark theme | |\n| Full layout, dark theme | |"]]