[[["容易理解","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-22 (世界標準時間)。"],[[["\u003cp\u003eThis page provides instructions for loading an intermediate iframe into your HTML pages for Google One Tap integration.\u003c/p\u003e\n"],["\u003cp\u003eYou can load the iframe using either the HTML API by including an element with the ID "g_id_intermediate_iframe" and relevant data attributes, or through the JavaScript API using the \u003ccode\u003egoogle.accounts.id.initializeIntermediate\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe intermediate iframe requires a \u003ccode\u003edata-src\u003c/code\u003e or \u003ccode\u003esrc\u003c/code\u003e attribute pointing to your One Tap intermediate iframe URI.\u003c/p\u003e\n"],["\u003cp\u003eOptionally, you can customize the behavior when the One Tap UX is finished by using \u003ccode\u003edata-done\u003c/code\u003e or \u003ccode\u003edone\u003c/code\u003e attributes to specify a JavaScript callback function.\u003c/p\u003e\n"]]],[],null,["# Intermediate iframe API reference\n\nThis reference page describes the Intermediate iframe API, used to embed the\nOne Tap prompt into web pages using an iframe.\n\nSee [Integrate One Tap using an iframe](/identity/gsi/web/amp/intermediate-iframe) for more information on working\nwith intermediate iframes.\n\nLoad the Intermediate Iframe JavaScript Library\n-----------------------------------------------\n\nPlace the following code snippet into any HTML pages that you want to Google One\nTap to display: \n\n \u003cscript src=\"https://accounts.google.com/gsi/intermediate\"\u003e\u003c/script\u003e\n\nHTML API\n--------\n\nYou can load the intermediate iframe by including an HTML element with the ID\nattribute set to `g_id_intermediate_iframe`. See the following example code\nsnippet: \n\n \u003cscript src=\"https://accounts.google.com/gsi/intermediate\"\u003e\u003c/script\u003e\n \u003cdiv id=\"g_id_intermediate_iframe\"\n data-src=\"https://example.com/onetap_iframe.html\"\u003e\n \u003c/div\u003e\n\n### Element with ID \"g_id_intermediate_iframe\"\n\nYou can put the intermediate iframe data attributes in any visible or invisible\nelements, such as `\u003cdiv\u003e` and `\u003cspan\u003e`. The only requirement is that the element\nID is set to `g_id_intermediate_iframe`. Don't put this ID on multiple\nelements.\n\nThe following table lists the data attributes with their descriptions:\n\n| Attribute ||\n|---------------------------------------------------------------|---------------------------------------------------------------------------|\n| [data-src](/identity/gsi/web/amp/nonamp-reference#data-src) | The URI of your One Tap intermediate iframe |\n| [data-done](/identity/gsi/web/amp/nonamp-reference#data-done) | A JavaScript callback method to be triggered when the One Tap UX is done. |\n\n#### data-src\n\nThis attribute is the URI of your One Tap intermediate iframe. See the following\ntable for further information:\n\n| Type | Required | Example |\n|--------|----------|-----------------------------------------------------|\n| string | Yes | `data-src=\"https://example.com/onetap_iframe.html\"` |\n\n#### data-done\n\nThis attribute is a JavaScript callback method triggered when the One Tap UX\nis done.\n\nBy default, the content page is reloaded when the One Tap UX is done. You\ncan override the default behavior by providing your own done callback. See the\nfollowing table for further information:\n\n| Type | Required | Example |\n|----------|----------|-------------------------------|\n| Function | Optional | `data-done=\"onOneTapSuccess\"` |\n\nJavaScript API\n--------------\n\nYou can load the intermediate iframe by calling a JavaScript method.\n\n### Method: google.accounts.id.initializeIntermediate\n\nThe `google.accounts.id.initializeIntermediate` method load the intermediate\niframe based on the configuration object. See the following code example of the\nmethod: \n\n google.accounts.id.initializeIntermediate(IntermediateConfig)\n\nThe following code example implements the\n`google.accounts.id.initializeIntermediate` method with an `onload` function: \n\n \u003cscript\u003e\n window.onload = function () {\n google.accounts.id.initializeIntermediate({\n src: 'https://example.com/intermediate'\n });\n };\n \u003c/script\u003e\n\n### Data type: IntermediateConfig\n\nThe following table lists the fields with their descriptions:\n\n| Field ||\n|-----------------------------------------------------|--------------------------------------------------------------------------|\n| [src](/identity/gsi/web/amp/nonamp-reference#src) | The URI of your One Tap intermediate iframe |\n| [done](/identity/gsi/web/amp/nonamp-reference#done) | A JavaScript callback method to be triggered when the One Tap UX is one. |\n\n#### src\n\nThis field is the URI of your One Tap intermediate iframe. See the following\ntable for further information:\n\n| Type | Required | Example |\n|--------|----------|-------------------------------------------------|\n| string | Yes | `src: \"https://example.com/onetap_iframe.html\"` |\n\n#### done\n\nThis field is the JavaScript callback method to be triggered when the One Tap UX\nis done.\n\nBy default, the content page is reloaded when the One Tap UX is done. You\ncan override the default behavior by providing your own done callback. See the\nfollowing table for further information:\n\n| Type | Required | Example |\n|----------|----------|-------------------------|\n| Function | Optional | `done: onOneTapSuccess` |"]]