To change the URL after ?redirect= to the current visiting URL (un-encoded) using JavaScript wth jQuery.
.searchParams used
Example original links:
https://app.example.com/?redirect=www.111.comhttps://app.example.com/?redirect=www.222.comhttps://app.example.com/?redirect=www.333.com