संग्रह की मदद से व्यवस्थित रहें अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
google.script.history एक एसिंक्रोनस क्लाइंट-साइड JavaScript API है, जो में दी गई जानकारी देख सकते हैं. इसका इस्तेमाल सिर्फ़ उस वेब ऐप्लिकेशन के संदर्भ में किया जा सकता है जो IFRAME. इसे ऐड-ऑन में साइडबार और डायलॉग के साथ इस्तेमाल करने के लिए नहीं बनाया गया है या कंटेनर-स्क्रिप्ट संदर्भ का इस्तेमाल करेगा. ज़्यादा जानकारी के लिए, देखें ब्राउज़र का इस्तेमाल करने के लिए गाइड वेब ऐप्लिकेशन में इतिहास.
यह विकल्प ब्राउज़र इतिहास में हुए बदलावों का जवाब देने के लिए, कॉलबैक फ़ंक्शन सेट करता है
विस्तृत दस्तावेज़
push(stateObject, params, hash)
दिए गए स्थिति ऑब्जेक्ट, यूआरएल पैरामीटर, और यूआरएल फ़्रैगमेंट को ब्राउज़र इतिहास में पुश करता है स्टैक. स्टेट ऑब्जेक्ट एक सामान्य JavaScript ऑब्जेक्ट होता है, जिसे डेवलपर तय करता है और यह ऐप्लिकेशन की मौजूदा स्थिति से जुड़ा कोई भी डेटा शामिल होना चाहिए. यह तरीका pushState() JavaScript तरीका.
Index.html
var now = new Date(); var state = { 'timestamp': now.getTime() }; var params = { 'options': "none" }; google.script.history.push(state, params, "anchor1");
पैरामीटर
नाम
टाइप
ब्यौरा
stateObject
Object
डेवलपर का तय किया गया ऑब्जेक्ट ब्राउज़र इतिहास के इवेंट से जुड़ा होता है और स्टेटस पॉप-अप होने पर फिर से दिखता है. आम तौर पर इसका इस्तेमाल ऐप्लिकेशन की स्थिति की जानकारी (जैसे कि पेज डेटा) को सेव करने के लिए किया जाता है, ताकि उसे बाद में वापस पाया जा सके.
params
Object
एक ऑब्जेक्ट, जिसमें इस राज्य से संबद्ध करें. उदाहरण के लिए, {foo: “bar”, fiz: “baz”} इसका मतलब है "?foo=bar&fiz=baz". इसके अलावा, अरे का इस्तेमाल भी किया जा सकता है: {foo: [“bar”, “cat”], fiz: “baz”}, "?foo=bar&foo=cat&fiz=baz" के बराबर है. अगर शून्य या तय नहीं है, तो मौजूदा यूआरएल पैरामीटर में बदलाव नहीं होता है. अगर यूआरएल पैरामीटर खाली होते हैं, तो साफ़ किया.
hash
String
इसके बाद दिखाई देने वाला स्ट्रिंग यूआरएल फ़्रैगमेंट '#' वर्ण. अगर शून्य या तय नहीं है, तो मौजूदा यूआरएल फ़्रैगमेंट में बदलाव नहीं होता है. अगर खाली है, तो यूआरएल फ़्रैगमेंट मिटा दिया गया है.
replace(stateObject, params, hash)
यह ब्राउज़र इतिहास स्टैक पर मुख्य इवेंट को, डेवलपर की तय की गई स्थिति से बदलता है ऑब्जेक्ट, यूआरएल पैरामीटर, और यूआरएल फ़्रैगमेंट. अन्य मामलों में यह इसके जैसा है push() का इस्तेमाल करता है.
Index.html
var now = new Date(); var state = { 'timestamp': now.getTime() }; var params = { 'options': "none" }; google.script.history.replace(state, params, "anchor1");
पैरामीटर
नाम
टाइप
ब्यौरा
stateObject
Object
डेवलपर का तय किया गया ऑब्जेक्ट ब्राउज़र इतिहास के इवेंट से जुड़ा होता है और स्टेटस पॉप-अप होने पर फिर से दिखता है. आम तौर पर इसका इस्तेमाल ऐप्लिकेशन की स्थिति की जानकारी (जैसे कि पेज डेटा) को सेव करने के लिए किया जाता है, ताकि उसे बाद में वापस पाया जा सके.
params
Object
एक ऑब्जेक्ट, जिसमें इस राज्य से संबद्ध करें. उदाहरण के लिए, {foo: “bar”, fiz: “baz”} इसका मतलब है "?foo=bar&fiz=baz". इसके अलावा, अरे का इस्तेमाल भी किया जा सकता है: {foo: [“bar”, “cat”], fiz: “baz”}, "?foo=bar&foo=cat&fiz=baz" के बराबर है. अगर शून्य या तय नहीं है, तो मौजूदा यूआरएल पैरामीटर में बदलाव नहीं होता है. अगर यूआरएल पैरामीटर खाली होते हैं, तो साफ़ किया.
hash
String
इसके बाद दिखाई देने वाला स्ट्रिंग यूआरएल फ़्रैगमेंट '#' वर्ण. अगर शून्य या तय नहीं है, तो मौजूदा यूआरएल फ़्रैगमेंट में बदलाव नहीं होता है. अगर खाली है, तो यूआरएल फ़्रैगमेंट मिटा दिया गया है.
setChangeHandler(function)
ब्राउज़र इतिहास में हुए बदलावों के जवाब देने के लिए, कॉलबैक फ़ंक्शन सेट करता है. कॉलबैक फ़ंक्शन आर्ग्युमेंट के तौर पर, सिर्फ़ एक इवेंट ऑब्जेक्ट लेना चाहिए.
Index.html
google.script.history.setChangeHandler(function (e) { console.log(e.state); console.log(e.location.parameters); console.log(e.location.hash); // Adjust web app UI to match popped state here... });
पैरामीटर
नाम
टाइप
ब्यौरा
function
Function
क्लाइंट-साइड इतिहास परिवर्तन इवेंट पर चलाने के लिए कॉलबैक फ़ंक्शन का इस्तेमाल करें इवेंट ऑब्जेक्ट का इस्तेमाल सिर्फ़ आर्ग्युमेंट के तौर पर करें.
इवेंट ऑब्जेक्ट
फ़ील्ड
e.state
पॉप किए गए इवेंट से जुड़ा स्टेट ऑब्जेक्ट. यह ऑब्जेक्ट, स्टेट के जैसा है ऐसा ऑब्जेक्ट जिसका इस्तेमाल संबंधित push() में किया गया हो या replace() का ऐसा तरीका जिसमें पॉप-अप की गई स्थिति जोड़ी गई हो इतिहास स्टैक में ले जाया जाएगा.
[[["समझने में आसान है","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-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003e\u003ccode\u003egoogle.script.history\u003c/code\u003e enables interaction with the browser history stack within web apps using \u003ccode\u003eIFRAME\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to push, replace, and monitor browser history state, including URL parameters and fragments.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can define custom state objects to store and retrieve application-specific data associated with history events.\u003c/p\u003e\n"],["\u003cp\u003eA change handler can be set to trigger a callback function in response to history changes, allowing dynamic UI updates.\u003c/p\u003e\n"]]],[],null,["`google.script.history` is an asynchronous client-side JavaScript API that can interact\nwith the browser history stack. It can only be used in the context of a web app that uses\n[`IFRAME`](/apps-script/reference/html/sandbox-mode#properties).\nIt is not intended for use with sidebars and dialogs in an add-on or\ncontainer-script context. For more information, see the\n[guide to using browser\nhistory in web apps](/apps-script/guides/web#web_apps_and_browser_history). \n\nMethods\n\n| Method | Return type | Brief description |\n|----------------------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------------------|\n| [push(stateObject, params, hash)](#push(Object,Object,String)) | `void` | Pushes the provided state object, URL parameters and URL fragment onto the browser history stack. |\n| [replace(stateObject, params, hash)](#replace(Object,Object,String)) | `void` | Replaces the top event on the browser history stack with the provided state object, URL parameters and URL fragment. |\n| [setChangeHandler(function)](#setChangeHandler(Function)) | `void` | Sets a callback function to respond to changes in the browser history |\n\nDetailed documentation \n\n`push(stateObject, params, hash)`\n\nPushes the provided state object, URL parameters and URL fragment onto the browser history\nstack. The state object is a simple JavaScript Object that is defined by the developer and can\ncontain any data relevant to the app's current state. This method is analogous to the\n[pushState()](https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method)\nJavaScript method. \n\nIndex.html \n\n```html\nvar now = new Date();\nvar state = {\n 'timestamp': now.getTime()\n};\nvar params = {\n 'options': \"none\"\n};\ngoogle.script.history.push(state, params, \"anchor1\");\n```\n\nParameters\n\n| Name | Type | Description |\n|---------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `stateObject` | `Object` | An developer-defined object to be associated with a browser history event, and which resurfaces when the state is popped. Typically used to store application state information (such as page data) for future retrieval. |\n| `params` | `Object` | An object containing URL parameters to associate with this state. For example, `{foo: \"bar\", fiz: \"baz\"}` equates to `\"?foo=bar&fiz=baz\"`. Alternatively, arrays can be used: `{foo: [\"bar\", \"cat\"], fiz: \"baz\"}` equates to `\"?foo=bar&foo=cat&fiz=baz\"`. If null or undefined, the current URL parameters are not changed. If empty, the URL parameters are cleared. |\n| `hash` | `String` | The string URL fragment appearing after the '#' character. If null or undefined, the current URL fragment is not changed. If empty, the URL fragment is cleared. |\n\n*** ** * ** ***\n\n*** ** * ** ***\n\n`replace(stateObject, params, hash)`\n\nReplaces the top event on the browser history stack with the provided (developer-defined) state\nobject, URL parameters and URL fragment. This is otherwise identical to\n[push()](#push(Object,Object,String)). \n\nIndex.html \n\n```html\nvar now = new Date();\nvar state = {\n 'timestamp': now.getTime()\n};\nvar params = {\n 'options': \"none\"\n};\ngoogle.script.history.replace(state, params, \"anchor1\");\n```\n\nParameters\n\n| Name | Type | Description |\n|---------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `stateObject` | `Object` | An developer-defined object to be associated with a browser history event, and which resurfaces when the state is popped. Typically used to store application state information (such as page data) for future retrieval. |\n| `params` | `Object` | An object containing URL parameters to associate with this state. For example, `{foo: \"bar\", fiz: \"baz\"}` equates to `\"?foo=bar&fiz=baz\"`. Alternatively, arrays can be used: `{foo: [\"bar\", \"cat\"], fiz: \"baz\"}` equates to `\"?foo=bar&foo=cat&fiz=baz\"`. If null or undefined, the current URL parameters are not changed. If empty, the URL parameters are cleared. |\n| `hash` | `String` | The string URL fragment appearing after the '#' character. If null or undefined, the current URL fragment is not changed. If empty, the URL fragment is cleared. |\n\n*** ** * ** ***\n\n`setChangeHandler(function)`\n\nSets a callback function to respond to changes in the browser history. The callback function\nshould take only a single [event object](#eventObject) as an argument.\n\nIndex.html \n\n```html\ngoogle.script.history.setChangeHandler(function (e) {\n console.log(e.state);\n console.log(e.location.parameters);\n console.log(e.location.hash);\n\n // Adjust web app UI to match popped state here...\n});\n```\n\nParameters\n\n| Name | Type | Description |\n|------------|------------|----------------------------------------------------------------------------------------------------------------------------------|\n| `function` | `Function` | a client-side callback function to run upon a history change event, using the [event object](#eventObject) as the only argument. |\n\nEvent object\n\n| Fields ||\n|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `e.state` | The state object associated with the popped event. This object is identical to the state object that used in the corresponding [push()](#push(Object,Object,String)) or [replace()](#replace(Object,Object,String)) method that added the popped state to the history stack. ``` {\"page\":2, \"name\":\"Wilbur\"} ``` |\n| `e.location` | A [location object](/apps-script/guides/html/reference/url#locationObject) associated with the popped event ``` {\"hash\":\"\", \"parameter\":{\"name\": \"alice\", \"n\": \"1\"}, \"parameters\":{\"name\": [\"alice\"], \"n\": [\"1\", \"2\"]}} ``` |\n\n*** ** * ** ***"]]