how to load external source to iframe instead of download?

↘锁芯ラ 提交于 2019-12-23 13:14:30

问题


I have an iframe where i try to put a link in the src. the src is to a html file that is normally being downloaded from the server to the file system, but i now want to show it in the iframe instead. is there a way to force an iframe to load whatever it gets in the src instead of downloading it??

edit:

i'm using jquery,

$('#webinfo').attr( "src", path); 

where webinfo is my iframe. when I load this it puts the html file the path is pointing at in my download folder instead of displaying it in my iframe. this is my definition of the iframe.

<div id="webdiv">
    <iframe class="webdivSetup" id="webinfo" src=""></iframe>
</div>

and my css

#webdiv{
    display: block;
    overflow-x: hidden;
    overflow-y: scroll;

    height: calc(100% - 40px);
}
.webdivSetup{
    height: 100%;
    width: 100%;
    border: none;
}

来源:https://stackoverflow.com/questions/22947320/how-to-load-external-source-to-iframe-instead-of-download

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!