app.loshadki

07. JavaScript Editor for Apps

Table of content

Window

Window

Working with the Script Editor

You can configure a test URL to work with and be able to run the script to see the Result and Console Log output.

Examples

Depending on the type of application you are editing and which handler, you can find some examples in the menu list under the Script Editor.

Available objects

Using JavaScript you can change the URL.

The url object is available for the script.

With the properties:

  • fragment - everything after # (string)
  • host - hostname and port (string)
  • hostname - just a domain, hostname (string)
  • href - string representation of full URL (string)
  • username - username (string)
  • password - password (string)
  • pathname - the path (string)
  • port - port (string)
  • protocol - scheme (string)
  • search - query of the URL (string)
  • searchParams - object to work on URL query (SearchParams)

SearchParams provides an object with the following methods:

  • append(name, value) - append the search key value
  • delete(name) - delete all query items with the name
  • get(name) - get the first value of the query with the name
  • getAll(name) - get all values as an array of the query with the name
  • has(name) - check if the query has a key
  • set(name, value) - set the name and value for the search
  • keys() - get the array of all keys

Debugging

You can use console.log("test") to write to the console output.

Examples

  • Change scheme:
url.protocol = "music"
  • Remove search parameter:
url.searchParams.delete("utm")