javascript get url without parameters code example
Example 1: javascript redirect with extra url arguments
if (window.location.search === '') {
window.location = window.location.origin + '?arg=1'
} else {
window.location = window.location.origin + window.location.search + '&arg=1'
}
Example 2: how to send query parameters in url vuejs
// with query, resulting in /register?plan=private
router.push({ path: 'register', query: { plan: 'private' }})