javascript: Remove illegal characters in url