Call Django url namespace inside window.open

Question:

Good day, all.

Currently, I want to try if the user clicks the update button on the web and then shows a popup window for updating their data. Before I have line code for updates like this:

<a class = "btn btn-outline-primary" href="{% url 'help:update show.id %}">Update</a>

then I added the URL inside the window.open with an id parameter like this:

onclick="window.open('update',show.id, 'newwindow', 'width=400, height=250'); return false;"

the page is open but in the same tab not in the new window as I expected in the pop-up. Is there any way to do like I expected? Thank you 🙂

Asked By: Mr Bim

||

Answers:

This is the Syntax for window.open()

window.open(URL, name, specs, replace);

To open the target url in a new window, the second parameter ‘name’ must be either ‘_blank’ or left blank.

Also from running a couple of tests it seems necessary to include something not blank in the third parameter as well. so,

so,

window.open('','',"width=200,height=100");

seems to work as expected. or even :

window.open("", "", "popup");
Answered By: user2514436
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.