Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programmieren:javascript:url_mit_paramatern_aendern_und_laden [2022/01/31 20:43] jgehrkeprogrammieren:javascript:url_mit_paramatern_aendern_und_laden [2022/12/17 12:28] (current) – external edit 127.0.0.1
Line 7: Line 7:
 const url_path          = window.location.pathname;          // folder/subpage.php/ const url_path          = window.location.pathname;          // folder/subpage.php/
 const url_search_string = window.location.search;            // ?parameter=true&other_param=1024 const url_search_string = window.location.search;            // ?parameter=true&other_param=1024
- url_params_object = new URLSearchParams( url_search ); // converts params to manipulatable object+      url_params_object = new URLSearchParams( url_search_string ); // converts params to manipulatable object
       url_params_object.set( 'other_param', 'new_value');    // change a parameter       url_params_object.set( 'other_param', 'new_value');    // change a parameter
 const url_params_string = url_params.toString();             // get paramaters as string const url_params_string = url_params.toString();             // get paramaters as string
Line 16: Line 16:
  
 **Hinweis:** nicht IE11 kompatibel, wegen URLSearchParams() **Hinweis:** nicht IE11 kompatibel, wegen URLSearchParams()
 +
 +**MDN Doku:**
 +  * [[https://developer.mozilla.org/en-US/docs/Web/API/Window/location|window.location]]
 +  * [[https://developer.mozilla.org/de/docs/Web/API/URLSearchParams|new URLSearchParams( url_search )]]

Page Tools