Recently, I received a report from one of my loyal blog visitors through a comment on a post that contains a download link.
I have an article with several hyperlinks, and one of them I want to monetize with direct link ads. When I click on it, I have to open two pages.
Without JavaScript, it's impossible to open two pages with a single click hyperlink, but for JS, it's simple:
<p><a href="#" onclick="window.open('http://google.com'); window.open('http://yahoo.com');">Click to open Google and Yahoo</a></p>
Note that techniques like this will be blocked by the browser, and there will be a notification about allowing pop-ups. This is a problem for my business model, so is there a trick that can be done with just HTML?
Solution
Finally, I tried combining both methods, using href
and onclick
, and the result was amazing, just as I expected!
<a href="https://example.com/4/link1" onclick="window.open('https://example.com/4/link2');">Download</a>