Error: SyntaxError: DOM Exception 12 setRequestHeader @ [native code]

I am developing a mobile application for Android and IOS using Phonegap and AngularJS, CORS_REST. I have everything that works on Android headers. When testing on iPhone with GapDebug.

Here is an example authentication code:

$http.post('someurlhere', {username: username, password: password}) .then(function (response) { if(!response.IsAuthenticated) { alertsManager.addAlert('Username or password is incorrect', 'alert-danger'); } callback(response); console.log(response); }); 

I get an error message:

Syntax Error: DOM 12_IMG exception

If anyone could help, I would really appreciate it.

Thanks:

+6
source share
1 answer

Please check the parameters of the headers, iOS9 does not accept parameters in http headers that have a space at the beginning of the value. Example:

"Token": "Token12345" => wrong "Token": "Token12345" => correct

Hope this helps you.

+16
source

All Articles