gpt4 book ai didi

javascript - 使用 Window.open() 时,ASP Core Javascript 将 http 重定向到 https

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:21:07 26 4
gpt4 key购买 nike

我们有一个 ASP 核心网络应用程序,主站点是 https。我们在 javascript 中有代码打开一个新的 iframe,该 iframe 应该指向另一个 http 站点。我们为 window.open 函数提供了一个 http://站点,但注意到当它打开时,它将 http 替换为 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');

最佳答案

很有可能做到:

<button>EXAMPLE.COM</button>

<script>
document.querySelector('button').addEventListener('click', () => {
alert('EXAMPLE.COM');
window.open("http://example.com/", 'theFrame');
});
</script>

参见 https://jsfiddle.net/o3n7cd6g/3/

关于javascript - 使用 Window.open() 时,ASP Core Javascript 将 http 重定向到 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58468820/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com