Plugin

Archived
Forum
(read-only)

AJAX Form Validator

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

Refused to set unsafe header

Support Request

REMOVED5g9d8n6ng
REMOVED5g9d8n6ng

When validating an input against a database entry i.e. deny_different_data or deny_duplicate_data


I get these errors in chrome console:

Refused to set unsafe header “Content-length”
Refused to set unsafe header “Connection”


After some search, I found these two pages:
http://stackoverflow.com/questions/2623963/webkit-refused-to-set-unsafe-header-content-length
https://developer.mozilla.org/en-US/docs/XMLHttpRequest_changes_for_Gecko1.8


Based on that, I’ve commented these lines from the plugin:


Lines 1578 and 1579

ajaxFormValidatorEntry<?$entry_id ?>.http[field_name].setRequestHeader("Content-length"params.length);
ajaxFormValidatorEntry<?$entry_id ?>.http[field_name].setRequestHeader("Connection""close"); 


Lines 1601 and 1602

ajaxFormValidatorEntry<?$entry_id ?>.http2[field_name].setRequestHeader("Content-length"params.length);
ajaxFormValidatorEntry<?$entry_id ?>.http2[field_name].setRequestHeader("Connection""close"); 


Now, every thing is OK and I guess the problem is solved.

Laisvunas
# 1
Developer
Laisvunas

These errors are Crome only, displayed only in console, and does not interfere into functioning of the script, so you can safely ignore them.

betrob
# 2
betrob

m-alshehri, I have been facing the same issue…. Could you please tell me in which plugin you commented out the above lines to have it working for you ?

I am using Jquery 1.9.1, Jquery Mobile 1.3.1 and Phonegap 2.8.0. How to I set the header in this set up ?

I find that I am able to set the “Connection” and “Keep-Alive” header’s without any issues on iPhones and Android Phones with OS less than 4.0.0.

Could you kindly suggest what I should be changing.

Thanks a million.