Heim  >  Artikel  >  Web-Frontend  >  304 CORS_html/css_WEB-ITnose

304 CORS_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:451202Durchsuche

304响应, CORS问题: 没有 Access-Control-Allow-Origin 这个头信息时,以前次返回的200请求为准。

示例:可能已被删除
http://7af3zm.com1.z0.glb.clouddn.com/ajax_304_cors.html

附上源码:
html

<!doctype html><html><head>	<meta charset="UTF-8"></head><body><script type="text/javascript">// var _ajax_34re = false;	function getAjax () {		var _ajax_34re = false;		if (_ajax_34re) {			return _ajax_34re;		}		try {			_ajax_34re = new XMLHttpRequest();	   } catch (trymicrosoft) {	     try {			_ajax_34re = new ActiveXObject("Msxml2.XMLHTTP");	     } catch (othermicrosoft) {	       try {			_ajax_34re = new ActiveXObject("Microsoft.XMLHTTP");	       } catch (failed) {			_ajax_34re = false;	       }	     }	   }		return _ajax_34re;	}	function load(url) {		request =  getAjax ();		request.open("GET", url);    	request.onreadystatechange = updatePage;    	request.send(null);   }   function updatePage() {     if (request.readyState == 4)       if (request.status == 200)         alert("Server is done!" + request.responseText);       else if (request.status == 404)         alert("Request URL does not exist");       else         alert("Error: status code is " + request.status);   }</script><pre class="brush:php;toolbar:false">	access: 200、304响应都有 Access-Control-Allow-Origin:*;	access-non: 200、304响应都 没 有 Access-Control-Allow-Origin;	access-200: 200响应都有 Access-Control-Allow-Origin:*, 304响应 没 有 Access-Control-Allow-Origin;
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn