Split url in JavaScript
Posted: Wed Feb 28, 2007 7:29 am
What I came up with so far is:
This is working perfect except when there is a question mark in the url like:
As you can see the url is not yet encoded and therefore there can be more question marks in it.
Is there a solution to split the url by the first question mark?
Code: Select all
var parts = url.split('?');
url = parts[0];
query = parts[1];Code: Select all
var url = 'javascript.php?action=list&name=Do you know?';Is there a solution to split the url by the first question mark?