You can use window.open():

<a href="javascript:window.open('some.html', 'yourWindowName', 'width=200,height=150');">Test</a>

Or:

<a href="#" onclick="window.open('some.html', 'yourWindowName', 'width=200,height=150');">Test</a>
Answer from Frédéric Hamidi on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › previous-versions › windows › desktop › htmlhelp › to-create-a-hyperlink-to-open-the-pop-up-window
To create a hyperlink to open the pop-up window | Microsoft Learn
Copy the following code in your HTML file to call the TextPopup method of the HTML Help ActiveX control: <A HREF="JavaScript:<i>popup</i>.TextPopup(<i>text_variable</i>, <i>font_variable</i>,9,9,-1,-1)"><i>Click Here</i></a> where popup is the ID you specified in step 2, text_variable and font_variable are the variable names you specified in step 1, the numeric values are the left and right margins (9,9) and the foreground and background colors (-1, -1) of the window, and Click Here is the link text.
🌐
Super Dev Resources
superdevresources.com › home › blog › development › how to open links in a popup window
How to Open Links in a Popup Window - Super Dev Resources
June 18, 2020 - In order to open them in a new window, we add target="_blank" attribute to links. However to open the links in a separate popup window, we can make use of the onclick property and specifying a inline JavaScript code window.open as shown below.
🌐
SitePoint
sitepoint.com › html & css
Help w/changing from hyperlink to pop-up box - HTML & CSS - SitePoint Forums | Web Development & Design Community
March 8, 2013 - I assumed that the numbers given were a width and a height respectively and you wanted no status bar on the popup and · BTW keep in mind that whether they leave the page or you open a new wind they are not still in the form , so the “read and agreed” check box still has to be checked in the original form ( but you probably already knew that) ... I understand what you mean. Here is the bit that does it. http://www.websitecodetutorials.com/code/javascript/js-accessible-pop-up-window.php
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-open-a-popup-on-click-using-javascript
How to Open a Popup on Click using JavaScript ? - GeeksforGeeks
August 5, 2025 - In this approach, we will use the classList property with toggle() method in JavaScript to toggle the visibility of the overlay and popup dialog elements. The openFn() function dynamically adds or removes the 'hidden' class, while adjusting ...
Top answer
1 of 3
1

onClick with a function:

<script type="text/javascript">
function AlertIt() {
  alert("ATTENTION! THIS IS AN ALERT");
}
</script>

<a href="javascript:AlertIt();">click me</a>

Complex single one-liner:

<a href="http://example.com/"
 onclick="return alert('Please click on OK to continue.');">click me</a>
2 of 3
0

You can make use of a hashchange-event!
Make a check-hash function and call it initially, so that loading the URL with the hash has the same behavior as changing the hash when already on-page.

You could create an array holding the IDs of the elements that should "listen" for such a hashchange, and give them a specific class (e.g. .hash-selected) when their ID equals the hash.

const hashes = ["#popup"]; // List of IDs that are "listening"
let lastHash = "";
function checkHash() {
  if (hashes.includes(lastHash)) // Remove class from last selected element
    document.querySelector(lastHash).classList.remove("hash-selected");
  if (hashes.includes(location.hash)) // Add class to current selected element
    document.querySelector(location.hash).classList.add("hash-selected");
  
  // Save current hash as 'lastHash' for first if-statement when calling 'checkHash()' again
  lastHash = location.hash;
}

checkHash(); // Initial function-call for same behavior on "page-open"
window.addEventListener("hashchange", () => checkHash());
body {margin: 0}
#popup {
  position: absolute;
  border-bottom: 1px solid black;
  width: 100%;
  transform: translateY(-100%);
  background: lightgreen;
}
#popup.hash-selected {transform: translateY(0)}
<div id="popup">
  <p>Some sample text</p>
  <a href="#">Close</a>
</div>
<a href="#popup">Open popup</a>

We could even easily fill the hashes-array with IDs of elements that have a specific class, like .hash-listen:

const hashes = [];
for (let el of document.querySelectorAll(".hash-listen"))
  hashes.push("#" + el.id);

// ...

Sidenote
To remove hashchanges from the browser-history, you should take a look at this answer that demonstrates the history.replaceState()-function.

🌐
Laurentian
web.cs.laurentian.ca › rsgrewal › c2206 › javascript › examples › windows › windows.html
Opening a pop up window
First click the following link to open a popup window. ... This method uses the link. ... The use of # as the link means that no link is actually taken: the link is being used to execute a javascript function.
Find elsewhere
🌐
SitePoint
sitepoint.com › javascript
Self close a Pop-Up -> then opening link in a new browser window? - JavaScript - SitePoint Forums | Web Development & Design Community
February 14, 2007 - Hi folks, I have a couple of Pop-Ups which contain links. These links should self close the Pop-Up, and then open up a new browser window to follow the link. I’m using the following function - but where do I specify that a new browser window should be used when someone clicks on the link (basically like a target: blank)? function goAndClose(url) { opener.location.href = url this.close; } and the link in the Pop-Up is marked like this:
🌐
Stack Exchange
sharepoint.stackexchange.com › questions › 274446 › how-to-make-a-modal-popup-when-someone-clicks-a-link-on-my-page
sharepoint on prem - How to make a Modal popup when someone clicks a link on my page - SharePoint Stack Exchange
<script type="text/javascript"> function showModalPopUp() { //Set options for Modal PopUp var options = { url: 'https://share.amazon.com/sites/NHOPlaybook/Shared Documents/Access Documents Message.PNG', //Set the url of the page title: 'Special ...
🌐
A List Apart
alistapart.com › article › popuplinks
Accessible Pop-up Links – A List Apart
March 19, 2004 - Now that our HTML is tidy, let’s get our hands dirty with the JavaScript implementation. I’ll spare you the simple one-liner (that would be a dull window.open wrapper) and provide you with some full-featured pop-up handling code: var _POPUP_FEATURES = ' location=0, statusbar=0, menubar=0, width=400, height=300 ';function raw_popup(url, target, features) { if (isUndefined(features)) { features = _POPUP_FEATURES; } if (isUndefined(target)) { target = '_blank'; } var theWindow = window.open(url, target, features); theWindow.focus(); return theWindow; }function link_popup(src, features) { return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features); }
🌐
Supsystic
supsystic.com › home › documentation › opening popup with link
How to open popup on click? Popup with HTML link
September 3, 2018 - In “When to show PopUp” block choose “Click on certain link / button / other element” radio button. Copy the shortcode from the first field of this option.
🌐
Spiceworks
community.spiceworks.com › it & tech careers
How to get a pop up when we click a a hyper link on a page? - IT & Tech Careers - Spiceworks Community
June 3, 2009 - Hello All, When I click a hyper link on a page system should bring me a small popup window. I do not want to use secondary page as it opens another window. when I was going through sites I under stood that we have to use java script and place in a html object then call the HTML object from the Iscript function.
🌐
Webflow
discourse.webflow.com › design help › layout & design
How to give a direct link to a pop-up - Layout & Design - Forum | Webflow
March 31, 2023 - I am trying to give some pop-ups I built on webflow {a click on button activates the pop-ups normally} shareable links, more like an anchor link that can easily open up my pop-ups once clicked on without having to click on the buttons. Here is my site Read-Only: LINK (how to share your site ...
🌐
Esri Community
community.esri.com › t5 › arcgis-online-questions › hyperlink-in-popup-to-open-in-new-window › td-p › 1541085
Solved: Hyperlink in Popup to open in new window - Esri Community
September 21, 2024 - Most browsers default to opening things in tabs, but I set mine to open in new windows, so is enforced by ArcGIS, but additionally I don't think you can embed Javascript in the HTML. Just for grins I tried this · <H1 onclick="alert('clicked'); " ############################## </H1>
🌐
Bricks Community Forum
forum.bricksbuilder.io › how to
Trigger popup through a link in html text - How To - Bricks Community Forum
Hello everyone! I’m wondering if there’s a way to display a popup when a user clicks on a link within a html text. I’m using a subscription form created with Bricks Builder, and it includes a consent checkbox with accomp…
Published   March 13, 2024
🌐
DaniWeb
daniweb.com › programming › web-development › threads › 538533 › how-to-open-a-modal-popup-after-click-of-hyperlink-using-asp-net
javascript - How to open a modal popup after click of ... | DaniWeb
If the modal still opens on load, check for code that reacts to location.hash and remove that behavior. This pattern cleanly separates server/data work and client UI, avoids automatic popups, and makes it easy to support both Bootstrap 4 (jQuery) and 5 (vanilla) without editing each row's markup.
🌐
PTC Community
community.ptc.com › t5 › ThingWorx-Developers › opening-a-popup-window-on-hyperlink-click-event-within-a-grid-in › td-p › 509724
opening a popup window on hyperlink click event within a grid in thingworxs
March 5, 2018 - But one of my column is a look a like of hyperlink. on click of hyperlink only(not row, its just the hyperlinked column) I need to launch a navigation widget window. if I use the in built, hyperlink option, it will not allow me to navigate to internal mashup's on a popup, it will always open in a new tab or replace the self.