doc/developers/README.GUI.ntopng_utility_js.md
The ntpng_url_manager function provides utilities for managing and manipulating URL parameters in a web application. This is often used to store temporary user settings or state information
that's passed through links.
This section describes each of the functions provided by the ntpng_url_manager object, along with their expected input types and behavior. First import the class when needed.
import { ntopng_url_manager } from "http_src/services/context/ntopng_globals_services.js";
// Invoke method_X()
ntopng_url_manager.method_X()
get_url_paramsget_url_search_params(url)url (optional) - A URL to analyze for search parameters. If not provided, uses the current page's URL.URLSearchParams object containing the query parameters.get_url_entries(url)url (optional) - A URL to analyze for search parameters. If not provided, uses the current page's URL.[key, value] pairs for each entry in the query string.get_url_entry(param_name, url)param_name: A string representing the name of the parameter to find.url (optional) - A URL to analyze for search parameters. If not provided, uses the current page's URL.get_url_object(url)url (optional) - A URL to analyze for search parameters. If not provided, uses the current page's URL.open_new_window(url)url (optional) - A URL to open in a new window. If not provided, uses the current page's location.reload_url()go_to_url(url)url: A URL to navigate to.replace_url(url_params)url_params: An object containing query parameters as key-value pairs.replace_url_and_reload(url_params)url_params: An object containing query parameters as key-value pairs.serialize_param(key, value)key: A string representing the parameter name to serialize.value: The associated value for the given key (default is an empty string).key=value.set_custom_key_serializer(key, f_get_url_param)key: The name of the parameter to customize serialization for.f_get_url_param: A function that customizes how this specific parameter is extracted from the URL's query parameters.obj_to_url_params(obj)obj: An object containing key-value pairs representing query parameters to convert into URL format.delete_params(params_key)params_key: An array of keys to delete from the current query parameters.delete_key_from_url(key)key: A string representing the key to delete from the URL query parameters.set_key_to_url(key, value)key: A string representing the key whose value is being set in the query parameters.value: The new value for the given key.add_obj_to_url(url_params_obj, url)url_params_obj: An object containing additional or updated query parameters as key-value pairs.url (optional): A URL to which these parameters will be added. If not provided, uses the current page's location.These methods provide comprehensive control over navigation and query parameter management on web pages, supporting both user interactions and dynamic content loading.