jquery removing everything after question mark in url

jquery, parameters, url

Solution

Since the url is controlled by the browser when you change the url the page will reload. Still for what you want to do, on pages where you don't need the stuff after the `?` mark type..

window.location = "http://www.mysite.com" //or whatever your site url is

To dynamically do this you can use the below function and then use `window.location`

function getPathFromUrl(url) {
  return url.split("?")[0];
}

Note: When you change the url the page will refresh.

Problem

I was wondering if I can remove everything after a question mark in a URL? `http://www.site.com?some_parameters_continue_forever` can I just use `.remove()`? What would need to be put inside the parameters? Thanks

Original source

Related problems