변수 var doc에 할당 된 HTML 문서 객체가 있습니다. 이 문서 개체를 사용하여 문자열 값을 렌더링 및 쓰기 있지만 IE11 브라우저에서 부적절한 형식으로 텍스트 파일을 렌더링 오전 IE8, IE10, ff n chrome.Flease 내 아래 코드를 찾을 :document.write()에 대한 크로스 브라우저 지원
function savecontent(str){
var filename = "data.txt";
var str=replaceAll(str,'<doublequote>','"');
var w = window.frames.w;
if(!w)
{
w = document.createElement('iframe');
w.id = 'w';
w.style.display = 'none';
document.body.insertBefore(w,null);
w = window.frames.w;
if(!w)
{
w = window.open('', '_temp', 'width=100,height=100');
if(!w)
{
window.alert('Sorry, could not create file.'); return false;
}
}
}
var doc = w.document;
doc.open('text/plain');
doc.charset="iso-8859-1";
doc.write(str);
doc.close(doc.write(str));
w.close();
if(doc.execCommand('SaveAs', false, filename))
{
window.alert("Please save the file.");
}
}
예상대로 내 캐릭터 라인은 ..로 IE11에서 렌더링
,
employee_firstname,employee_lastname,
employee_id,employee_salary,employee accountno,employee_dob
하지만 어디 employee_firstname, employee_lastname, employee_id입니다, employee_salary, 직원 accountno, employee_dob 등과 같이 할 수있는 곳 ED이고 데이터 IE8 렌더링되는, FF N 아래 형식 크롬 :
employee_firstname,employee_lastname,employee_id,
employee_salary,employee accountno,employee_dob
난 IE8, FF N 크롬 등의 다른 브라우저 예고 상이한 다른 브라우저에 비해 IE11에서 다르게 일어나는 개행 이다. 누구나 IE11 브라우저의 텍스트 파일이나 document.write()의 다른 형식으로 데이터 렌더링을 올바르게 형식화하는 방법을 알려주시겠습니까?
1) 전체 코드를 표시하는 문제를 재현합니다. 2) 차이점이 무엇인지 설명하십시오. 줄 바꿈의 위치 인 것처럼 보입니다.이게 진짜입니까? 3) 코드 조각은 여러 가지 이유로 작동하지 않습니다. 예를 들어'window'를 지역 변수로 사용하고'charset'을 설정하려고하는 것입니다. –
질문 수정 – kss
언급 한 문제 중 하나를 피하면서 코드를 수정했지만 여전히 기능 만합니다. 함수 호출도없고 HTML도 없습니다. –