Open popup windows with HTML and Javascript

Configure the opening of a pop-up window attached to a link

Not dilunghiamoci in useless talk and let’s get right to the point. To open a link in a separate pop-up window to our page, we need to insert inside the head of the page the following javascript code.

<script type="text/javascript">
function ApriPopup(pagina) {
   window.open(pagina, "", "top=20, left=30, width=600, height=200, status=no, menubar=no, toolbar=no scrollbars=no");
}
</script>

then, instead of inserting the link in the href of the link, the user must insert the call to our function that expects a link to open. Practically we have to write this code

<a href="javascript:ApriPopup('https://www.selectallfromdual.com/blog/')">Apri la popup</a>

We periodically check the functioning of the links in our articles. If you notice any links that do not work, please let us know in the comments. If you enjoyed the article consider supporting the blog with a small donation. Thank you. Patreon / Ko-fi / Liberapay / Paypal

Leave a Reply

Your email address will not be published. Required fields are marked *