Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am in the process of developing a mobile application for Android and IOS, with Phonegap and AngularJS, CORS_REST. I have just about everything working for the headers on Android. When testing on an iPhone with GapDebug.

Here is an example of the 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 am getting this a an error:

SyntaxError: DOM Exception 12_IMG

If anyone could please help I would greatly appreciate it.

Thank You:

like image 972
Jon Nowak Avatar asked Jan 05 '16 20:01

Jon Nowak


1 Answers

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

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

I hope this helps you.

like image 90
William Sousa Avatar answered Nov 07 '22 07:11

William Sousa