A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/guides/html/reference/url below:

Class google.script.url (Client-side API) | Apps Script

Class google.script.url (Client-side API)

Stay organized with collections Save and categorize content based on your preferences.

google.script.url is an asynchronous client-side JavaScript API that can query URLs to obtain the current URL parameters and fragment. This API supports the google.script.history API. It can only be used in the context of a web app that uses IFRAME. It is not intended for use with sidebars and dialogs in an add-on or container-script context. For more information, see the guide to using browser history in web apps.

Methods Method Return type Brief description getLocation(function) void Gets a URL location object and passes it to the specified callback function. Detailed documentation getLocation(function)

Gets a URL location object and passes it to the specified callback function (as the only argument).

Index.html
google.script.url.getLocation(function(location) {
  console.log(location.parameters);
  console.log(location.hash);
});
Parameters Name Type Description function Function a client-side callback function to run, using the location object as the only argument. Location object

The following table shows examples of the location elements that would be specified if the following URL was queried:

http://www.example.com?n=1&name=alice&n=2#headingAnchor Fields location.hash

The string value of URL fragment after the # character, or an empty string if no URL fragment is present

headingAnchor
location.parameter

An object of key/value pairs that correspond to the URL request parameters. Only the first value will be returned for parameters that have multiple values. If no parameters are present, this will be an empty object.

{"name": "alice", "n": "1"}
location.parameters

An object similar to location.parameter, but with an array of values for each key. If no parameters are present, this will be an empty object.

{"name": ["alice"], "n": ["1", "2"]}

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`google.script.url` is a client-side JavaScript API for querying URLs to get parameters and fragments within web apps."],["This API works with `google.script.history` and requires the use of `IFRAME` in your web app."],["The `getLocation()` method retrieves a URL location object containing parameters and hash information, passing it to a callback function."],["The location object provides access to URL components like hash, individual parameters, and all parameter values."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4