[英]window.close() stopped working after updating to Django 4
I updated packages in my project to latest version, and while testing in Firefox I encountered that window.open()
assigned to variable returns Object
- debugged with the code below:我将项目中的软件包更新为最新版本,在 Firefox 中进行测试时,我遇到分配给变量的
window.open()
返回Object
- 使用以下代码进行调试:
let test = window.open($(e.currentTarget).attr('href'), '_blank', "height=640,width=480,toolbar=0,location=0,menubar=0");
console.log(test);
And, when I close test (this object) using .close()
( test.close()
) it works just fine, but after upgrading packages (django 3 to 4 version) it stopped working, and test
variable returns Window
, not Object
.而且,当我使用
.close()
( test.close()
)关闭测试(这个对象)时它工作得很好,但是在升级包(django 3到4版本)之后它停止工作,并且test
变量返回Window
,而不是Object
.
I'm not really sure why it works that way, does Django 4 set some custom headers that cause the window
close mechanism not work properly?我不太确定它为什么会这样工作,Django 4 是否设置了一些导致
window
关闭机制无法正常工作的自定义标头? How I should fix that?我应该如何解决这个问题?
Okey, I know how Django affects that.好的,我知道 Django 如何影响它。
It's because the browser context is not set and cause are the new security features.这是因为未设置浏览器上下文,原因是新的安全功能。 To ommit that, set the
SECURE_CROSS_ORIGIN_OPENER_POLICY
variable to None
.要省略这一点,请将
SECURE_CROSS_ORIGIN_OPENER_POLICY
变量设置为None
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.