问题
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