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:
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
test.close()) it works just fine, but after upgrading packages (django 3 to 4 version) it stopped working, and
test variable returns
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? How I should fix that?
Okey, I know how Django affects that.
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