Google Identity Services در حال انتقال به APIهای FedCM است. راهنمای مهاجرت را دنبال کنید تا تغییرات احتمالی را بررسی کنید و از تأثیرات منفی ورود کاربر به وب سایت خود جلوگیری کنید.
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
به طور پیش فرض، درخواست One Tap در گوشه سمت راست بالای پنجره های مرورگر وب دسکتاپ نمایش داده می شود. هنگامی که از FedCM استفاده می شود، مرورگر به طور کامل مکان اعلان را کنترل می کند. بنابراین، طرحبندیهای سفارشی پشتیبانی نمیشوند .
در غیر این صورت، One Tap را در داخل یک عنصر ظرف نمایش دهید تا موقعیت درخواست را تغییر دهید. برای انجام این کار، شناسه DOM عنصر کانتینر را در ویژگی data-prompt_parent_id مشخص کنید.
مثال کد زیر از عنصر g_id_onload به عنوان عنصر کانتینر مجددا استفاده می کند و اعلان One Tap را در موقعیت مشخص شده نمایش می دهد:
تاریخ آخرین بهروزرسانی 2025-01-08 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-01-08 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eWith the migration of One Tap to the FedCM API, browsers will control the prompt's size and position, eliminating support for custom positions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers are advised against customizing the position for new One Tap integrations and to review the migration guide for existing integrations to ensure compatibility.\u003c/p\u003e\n"],["\u003cp\u003eCustomizing the One Tap login flow is possible, including positioning the prompt within a container element by utilizing the \u003ccode\u003edata-prompt_parent_id\u003c/code\u003e attribute, but avoid obscuring any prompt content to comply with Google's policies.\u003c/p\u003e\n"],["\u003cp\u003eRemember that the \u003ccode\u003edata-prompt_parent_id\u003c/code\u003e attribute is disregarded on mobile web browsers, limiting customization in those environments.\u003c/p\u003e\n"],["\u003cp\u003eHiding or manipulating the One Tap prompt's content to misrepresent its origin from a Google iframe can lead to severe consequences, including project or account suspension.\u003c/p\u003e\n"]]],[],null,["# Change the One Tap prompt position\n\n| **Warning:** When One Tap migrates to use the [FedCM API](https://developers.googleblog.com/2024/02/federated-credential-management-migration-for-google-identity-services.html), the browser controls the size and position of One Tap prompt. Custom positions are not supported. For new One Tap integration, you shouldn't customize the prompt's position. For existing integration, review the [migration guide](/identity/gsi/web/guides/fedcm-migration#layout) and update your app if necessary.\n| **Objective:** If the default login flow doesn't meet your requirements, you can customize it in several ways. Read the following information for available customization options.\n\nBy default, the One Tap prompt is displayed in the top-right corner of desktop\nweb browser windows. When [FedCM](/identity/gsi/web/guides/supported-browsers#compatibility) is used, browser fully controls the\nprompt location. Hence, custom layouts are **not** supported.\n\nOtherwise, display One Tap inside a container element to change prompt position.\nTo do so, specify the DOM ID of the container element in the\n`data-prompt_parent_id` attribute.\n| **Warning:** Don't hide any One Tap prompt content. Don't obscure the perception that the One Tap prompt content is from a Google iframe. Failure to do so may result in project suspension, account suspension, or both.\n\nThe following code example reuses the `g_id_onload` element as the container\nelement and displays the One Tap prompt in the specified position: \n\n \u003cdiv id=\"g_id_onload\"\n data-client_id=\"\u003cvar translate=\"no\"\u003eYOUR_GOOGLE_CLIENT_ID\u003c/var\u003e\"\n data-login_uri=\"\u003cvar translate=\"no\"\u003ehttps://your.domain/your_login_endpoint\u003c/var\u003e\"\n data-prompt_parent_id=\"g_id_onload\"\n style=\"position: absolute; top: 100px; right: 30px;\n width: 0; height: 0; z-index: 1001;\"\u003e\n \u003c/div\u003e\n\nThe `data-prompt_parent_id` attribute is ignored on mobile web browsers."]]