我们有一个ASP核心web应用程序和主网站是https。我们在javascript中编写了打开一个新iframe的代码,该iframe应该指向另一个站点,即http。我们为window.open函数提供了一个http://站点,但注意到当它打开时,它用https替换了https,这是一个问题。
有什么办法可以把它关掉吗?我们只想以http格式打开它。看起来很简单,但我找不到任何关于如何做到这一点的信息。
**更新1:在尝试了一段时间后,我决定尝试在没有目标的情况下使用Window.open,也就是我们弹出的模式iframe。它的工作方式和它的假设一样,并且以http而不是https的形式打开。
所以现在我必须弄清楚为什么把它放到iframe中会迫使它变成https。
该模式如下所示:
<div class="modal fade" id="rangeActiveModal" tabindex="-1" role="dialog" data-keyboard="false" data-backdrop="static">
<div class="vertical-alignment-helper">
<div class="modal-dialog vertical-align-center modal-lg">
<div class="modal-content">
<div class="modal-body">
<iframe name="theFrame"></iframe>
</div>
<div class="modal-footer">
<button type="button" id="btnRejoinEnvAndHide" name="button" value="Rejoin" class="btn btn-success">Rejoin</button>
<button type="button" id="btnStopEnvAndHide" name="button" value="Stop" class="btn btn-danger">Stop</button>
</div>
</div>
</div>
</div>
</div>
调用看起来是这样的:
arenaWin = window.open(url, 'theFrame');
发布于 2019-10-20 21:04:08
这样做是非常有可能的:
<button>EXAMPLE.COM</button>
<script>
document.querySelector('button').addEventListener('click', () => {
alert('EXAMPLE.COM');
window.open("http://example.com/", 'theFrame');
});
</script>
https://stackoverflow.com/questions/58468820
复制相似问题