Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing URL on button's click
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Coding, syntax & commands
Title:
Changing URL on button's click
Miscellaneous
Thread ID:
01670519
Message ID:
01670519
Views:
40
UPDATE. Had to spend many hours today trying various code but finally got it with this code at the end of my method:
.finally(() => {
                    Spinner.stopSpinner("updateBooking");
                    this.onReload();
                    Timeout(() => {
                        this.beforeUnload();
                    }, 0);
                });
Hi everybody,

I am wondering if it's possible at all to change URL's parameters (add one extra parameter to query string) on button's click?

I have the following code which works fine in our angular.js application on the right click event, but does nothing when I try to execute it on a button (input type="button") click. (E.g. when I trace it it does originally change URL but after all internal angular.js code is run the URL remains the same).
addParameterToUrl(paramName, value) {
            const urlParams = new URLSearchParams(window.location.search);

            urlParams.set(paramName, value);
            const newQuery = `${window.location.pathname}?${urlParams.toString()}`;

            history.pushState(null, "", newQuery);
        }
I added that same code also here
window.addEventListener("beforeunload", this.beforeUnload);
and it does seem to work when I test directly in Google Chrome.

However, the idea here is to call this from the C++ application via Chromium (?) My colleague told me she is not getting this extra parameter back.

Do you know if it's possible to change URL's search parameters on button's click without re-loading the page?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform