이전 브라우저 (IE5 및 IE6) XMLHttpRequest 객체 사용
이전 브라우저 (IE5 및 IE6) XMLHttpRequest 객체 사용
이전 버전의 Internet Explorer (5/6)는 XMLHttpRequest 객체 대신 ActiveX 객체를 사용합니다.
variable = new ActiveXObject("Microsoft.XMLHTTP");
IE5 및 IE6을 처리하려면 브라우저에서 XMLHttpRequest 객체를 지원하는지 확인하거나 ActiveX 객체를 만듭니다.
예
if (window.XMLHttpRequest) {
// code for modern browsers
xmlhttp = new XMLHttpRequest();
} else {
// code for old IE browsers
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
소스
<!DOCTYPE html>
<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<p id="demo">Let AJAX change this text.</p>
<button type="button" onclick="loadDoc()">Change Content</button>
<script>
function loadDoc() {
var xhttp;
if (window.XMLHttpRequest) {
// code for modern browsers
xhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
</script>
</body>
</html>
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5246 | node.js |
swallow
|
2년 전 | 1102 | |
| 5245 | PHP |
swallow
|
2년 전 | 2522 | |
| 5244 | PHP |
swallow
|
2년 전 | 1283 | |
| 5243 | JavaScript |
swallow
|
2년 전 | 683 | |
| 5242 | node.js |
swallow
|
2년 전 | 664 | |
| 5241 | node.js |
swallow
|
2년 전 | 773 | |
| 5240 | MySQL |
swallow
|
2년 전 | 801 | |
| 5239 | MySQL | 2년 전 | 775 | ||
| 5238 | JavaScript | 2년 전 | 976 | ||
| 5237 | 웹서버 |
swallow
|
2년 전 | 3984 | |
| 5236 | PHP |
swallow
|
2년 전 | 897 | |
| 5235 | PHP |
swallow
|
2년 전 | 1376 | |
| 5234 | 기타 | 2년 전 | 750 | ||
| 5233 | jQuery |
swallow
|
2년 전 | 2031 | |
| 5232 | 2년 전 | 612 | |||
| 5231 | 2년 전 | 1166 | |||
| 5230 | 2년 전 | 1067 | |||
| 5229 | PHP |
swallow
|
2년 전 | 1018 | |
| 5228 | MySQL | 2년 전 | 720 | ||
| 5227 | PHP |
swallow
|
2년 전 | 833 | |
| 5226 | PHP |
swallow
|
2년 전 | 1807 | |
| 5225 | PHP | 2년 전 | 574 | ||
| 5224 | node.js |
swallow
|
2년 전 | 4078 | |
| 5223 | PHP |
swallow
|
2년 전 | 1314 | |
| 5222 | 기타 |
techstar
|
2년 전 | 556 | |
| 5221 | PHP | 2년 전 | 648 | ||
| 5220 |
swallow
|
2년 전 | 901 | ||
| 5219 | 2년 전 | 874 | |||
| 5218 | 2년 전 | 520 | |||
| 5217 | 2년 전 | 995 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기