2012-08-28 2 views
0

HTML을 iFrame으로 설정해야합니다. (iframe이의 SRC가 null입니다.) 예 : I는 웹 메소드 호출에서 문자열 다음 얻을 : 문자열의 =머리글과 본문 태그가있는 HTML을 iframe에 설정하는 방법

<html> 
    <head> 
    <style type="text/css"> <!-- .some dynamicaly generated css> </style> 
    <link id="css1" type="text/css" rel="stylesheet" href="1.css" /></head> 

    <body style="padding:0; margin:0;" tabIndex="-1"> 
--- some HTML elements ------   
    <script type="text/javascript"> 
---some script --- 
    </script> 
    </body> 
    </html> 

내가 iframe이에이 문자열을 설정해야합니다. 하지만 iframe.innerHTML을 사용하면 head 태그와 body 태그를 제거합니다.

도와 주실 수 있습니까? 문자열에 무언가를 추가하거나 iframe에 속성을 추가해야합니까?

미리 감사드립니다.

+0

$.html(innerHtml);은 왜 어쨌든이 원하는거야라고 할 수 있습니까? can not 그냥 src를 iframe에로드하고 파일/스크립트에서 내용을로드 할 수 있습니까? – HerrSerker

+0

도메인 간 문제로 인해 src를 사용할 수 없습니다. –

+0

도메인에없는 경우 동영상을 표시 할 권리가 있습니까? – HerrSerker

답변

0

왜 jquery를 사용하지 않으시겠습니까? 더 편리 할 것입니다.

당신은 var innerHtml = $('Your html');

다음 사용자 기능

+0

불행히도 간단하게 작동하지 않습니다. 브라우저가 머리 태그와 본문 태그를 제거합니다. 자세한 내용은 여기를 참조하십시오. http://stackoverflow.com/questions/2488839/does-jquery-strip-some-html-elements-from-a-string-when- using-html –

관련 문제