Hi All
I have used the below javascript code to clear the input parameters shown in the url but when the page is refreshed since the input parameters are not there it is not behaving correctly. kindly let me know how to fix this issue
var uri = window.location.toString();if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri);}
Thanks
Kumar V
Hi @saravanakumar v ,
I have created the below forge component that will help you understand this concept with example.
https://www.outsystems.com/forge/component-overview/20876/how-to-hide-url-parameters-o11
Regards,
Manish Jawla
Hi @saravanakumar v , Please try using the window.location.href = clean_uri;
var uri = window.location.toString();
if (uri.indexOf("?") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("?"));
window.location.href = clean_uri;
}
Vinod
Hi Vinod
The code is not working
Hi @saravanakumar v , Please try below code.
// Before removing the parameters, store them in sessionStorage
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.toString()) {
sessionStorage.setItem('urlParams', urlParams.toString());
// Clean the URL by removing the parameters
window.history.replaceState({}, document.title, clean_uri);
// When the page is refreshed, check if the parameters were stored in sessionStorage
window.addEventListener('load', function() {
var storedParams = sessionStorage.getItem('urlParams');
if (storedParams) {
// Reapply the stored parameters to the URL if needed
window.history.replaceState({}, document.title, window.location.pathname + '?' + storedParams);
});
--RJ--
Hi Rahul
I have the previous code in onready action. can i place all this code in the same action ? please advise
Yes , you can use this code in onready event
The code did not work. Any advise
It will good if you put your detail screen logic inside the web block where you are passing the inputs which are visible over the url and call it inside your list screen by using simple condition and Boolean variable.
That will fix your parameters shown in url :).
hi manish
could you please give a sample oml. i am not able to understand it
Hi @saravanakumar v,
As per my understanding you are clearing the input parameter from URL due to security constraint, if yes there is another alternate option while you are creating records in entity you can save one more attribute UUID(unique id) along with entity identifier and you can pass it as a input parameter and in this way value of input can not be tempered.
Here is sample how you can save UUID in entity:
Regards
Shashi Kant Shukla