In Django, how can I get the response to be opened in a new window from the view?
if i do this, this will open the mynewpage.html in the original window
return HttpResponse('mynewpage')
I want to open mynewpage.html in a new window , separate from the originial.
Your server has no concept of windows - it just sends back files to the browser. You need to do this via javascript:
window.open('url to open','window name','attribute1,attribute2')
So you can either create a custom view and template whose job is to open a new window with a specified link, then return the main window to the page it was previously at, or simply open the url you want from the original window without contacting the server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With