2014-02-11 2 views
5

다음 코드가 있습니다. 페이지를 iframe 안에로드하려고했습니다. 하지만 iframe에만 로더를 표시합니다. IE 11에서만이 문제가 있습니다. 모든 브라우저에서 정상적으로 작동합니다.IE11의 iframe 안에 페이지가로드되지 않습니다.

<iframe src="https://docs.google.com/viewer?url=http://localhost/test_energy/img/Sample.pdf&embedded=true" width="570" height="300" style="border: none;"> 
</iframe> 

답변

8

시도 :

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 
+9

이 기능은 무엇입니까? – Doug

0

먼저 세미콜론을 제거하려고 ";" 귀하의 초기 코드에서

<iframe src="https://docs.google.com/viewer?url=http://localhost/test_energy/img/Sample.pdf&embedded=true" width="570" height="300" style="border: none;">;<- Remove this 

; < - 제거하십시오.

등으로 시도해보십시오.

<iframe src="https://docs.google.com/viewer?url=http://tobi.oetiker.ch/lshort/lshort.pdf&embedded=true" width="570" height="300" style="border: none;"></iframe> 
+0

@matts 안녕하세요, iframe 뒤에 어떤 세미콜론도 없습니다. 실제로 angle braket은 그걸 가져 가지 않았습니다. y는 <입니다. 이제 제거했습니다. – Ayesha

+0

확인 내 브라우저에 명시된 그것은 세미콜론 (weired)을 보여줍니다. 이 솔루션을 사용해보세요. http://stackoverflow.com/questions/14559060/display-pdf-using-an-ajax-call – mattts

+0

그리고 Firefox에서 작동하는 것을 거의 잊어 버렸을 가능성이 거의 있습니다. IE11에서 가장 잘 작동 할 것입니다. 범인이라고 생각합니다. IE 용 PDF 플러그인과 함께 – mattts

0

이 ..like iframe을 내부는 attachEvent라는 함수를 추가 잘 작동합니다 (IFRAME에서 jQuery를 스크립트 태그 앞에) :

var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/)); 

if (isIE11) { 
    if (typeof window.attachEvent == "undefined" || !window.attachEvent) 
    window.attachEvent = window.addEventListener; 
} 
관련 문제