Приведенная ниже ошибка кода с URIError: malformed URI sequence?
, когда в строке URL есть %
, в строке URL, откуда мне нужно извлечь значение параметра, например. http://some-external-server.com/info?progress=60%%20-%20Completed
URIError: некорректная последовательность URI?
<SCRIPT type="text/javascript">
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
</SCRIPT>
Я не имею контроль над сервером и нужно обработать вывод в моем HTML-страницы.
возможно дубликат из [Javascript decodeURI (Component) исключаемое исключение uri] (http://stackoverflow.com/questions/9064536/javascript-decodeuricomponent-malformed-uri-exception) – Christian
Возможный дубликат [Почему deco deURIComponent ('%') заблокирует мой браузер?] (http://stackoverflow.com/questions/7449588/why-does-decodeuricomponent-lock-up-my-browser) –