기본 콘텐츠로 건너뛰기

3월, 2015의 게시물 표시

allow ajax header in Android webview and ios uiwebview

my application is hybrid app. both android and ios works. local contents is loaded in apps. and add additional headers ajax server call. In my work around , server modification not allowed. local-content ajax add header. (ref http://stackoverflow.com/questions/3258645/pass-request-headers-in-a-jquery-ajax-get-call ) $ . ajax ({ url : "/test" , headers : { "X-Test-Header" : "test-value" } }); Android webview setting ( ref : http://stackoverflow.com/questions/8648616/webview-javascript-cross-domain-from-a-local-html-file ) Initialize your WebView: WebView _webView = ( WebView ) this . findViewById ( R . id . id_of_your_webview_in_layout ); get WebView settings: WebSettings settings = _webView . getSettings (); set following settings: settings . setJavaScriptEnabled ( true ); settings . setAllowFileAccessFromFileURLs ( true ); //Maybe you don't need this rule settings . setAllowUniversalAccessFromFileUR