Open answer in a new window

In Django, how can I get an answer to open in a new window from a view?

if I do this, this will open mynewpage.html in the original window

return HttpResponse('mynewpage')

I want to open mynewpage.html in a new window, separate from the original.

+7
source share
1 answer

Your server has no idea about windows - it just sends files back to the browser. You must do this using JavaScript:

window.open('url to open','window name','attribute1,attribute2')

Thus, you can either create your own view and template, the task of which is to open a new window with the specified link, then return the main window to the page on which it was previously, or simply open the desired link from the original window without communication with the server

+7
source

All Articles