기본적으로 서버에서 PHP 파일에 AJAX 호출을 수행하려고합니다. 이것은 XMLHttpRequest를 사용하여 작동하지 않는 것 같습니다. 내가 다음과 같은 파일이 있다고 가정하자 :Chrome 앱 : 서버의 파일에서 데이터 읽기 및 쓰기
PHP 파일 : http://abc.de.fg/folder/data.php
과 txt 파일 : 나는, 내 크롬 응용 프로그램에서, 그 PHP 파일에 일부 데이터를 전달하고 대기하는 http://abc.de.fg/folder/data.txt
응답을 위해. PHP 파일은 data.txt 파일을 읽고 씁니다.
내가 크롬 응용 프로그램 (I 표준 웹 페이지를 통해 실행할 때이 코드가 작동 알고있다) 나는 다음과 같은 오류 얻을에서이 작업을 수행 할 때 :
Refused to set unsafe header "Content-length" main.js:250
(anonymous function) main.js:250
Refused to set unsafe header "Connection" main.js:251
(anonymous function) main.js:251
OPTIONS http://abc.de.fg/folder/data.php No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://ndakgilfeodmfkdmoojoeeckpajmflcd' is therefore not allowed access. main.js:253
(anonymous function) main.js:253
XMLHttpRequest cannot load http://abc.de.fg/folder/data.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://ndakgilfeodmfkdmoojoeeckpajmflcd' is therefore not allowed access.
나는 JSONP가 크롬 응용 프로그램에서 사용되는 콘텐츠 보안 정책으로 인해 작동합니다 생각하지 않습니다. http://developer.chrome.com/apps/contentSecurityPolicy.html – MatrixFrog
@MatrixFrog 중요한 추가 사항입니다. 고맙습니다. – Kiruse