Jump to content

How to remove everything after "?" from string (URL+tracking code)?


Recommended Posts

Posted

Occasionally webpages show an URL with an appended "?" and a tracking code like

http://www.foobar.com/some/path/before.html?after-is-tracking=12345

Assume I assign this URL to a variable:

How can I remove (with Javascript or even better with jQuery)  everything after "?" including the "?" itself?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...