• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

SANAZI.MY

Blog entry rojak ikut suka hati. Sekadar pandangan peribadi dan tutorial berdasarkan pengalaman sendiri. Bukan yang terbaik, tetapi berharap dapat deliver sesuatu yang bermanfaat untuk semua.

  • SANAZI.MY
  • Peta Laman
  • Tentang
  • Penafian
  • Polisi Privasi
  • Hubungi
You are here: Home / Blogger Tutorials / How to open multiple links using a single click

How to open multiple links using a single click

22/03/2014 by Toji Ali Leave a Comment

open multiple links
Open multiple links with single hyperlink

Hello guys, today I want to show you how you can open up multiple links using a single click.
The method behind this trick is to put multiple links on single hyperlink.

This is the normal link would look like.

<a href=”YOUR-LINK” alt=”_blank”>YOUR ANCHOR TEXT</a>

Let say you want to open two links when a visitor clicks a link, what you have to do is modify above code and add this code

onclick=”window.open(&quot;YOUR-2nd-LINK&quot;);”

just before first closing bracket “>” symbol.

And the new code would be like this

<a href=”YOUR-LINK” onclick=”window.open(&quot;YOUR-2nd-LINK&quot;);” >YOUR ANCHOR TEXT</a>

But I use another approach and use below code instead to open two links. Using above approach, I can’t figure out how to open the first link in new tab as I already added alt=”blank” to the code. But the below approach does work.

<a target=”_blank” onclick=”window.open(&quot;YOUR-LINK&quot;); window.open(&quot;YOUR-2nd-LINK&quot;);” >YOUR ANCHOR TEXT</a>

Here a demo, Click to open two links in new tabs.

To open three links it would be like this

<a target=”_blank” onclick=”window.open(&quot;YOUR-LINK&quot;); window.open(&quot;YOUR-2nd-LINK&quot;); window.open(&quot;YOUR-3nd-LINK&quot;);” >YOUR ANCHOR TEXT</a>

Click to open two links in new tabs.

And if you want add more link, press spacebar once before ” >YOUR ANCHOR TEXT</a> and insert window.open(&quot;YOUR-NEW-LINK&quot;);.

Hope this will be helpful.

And before I end this post, you should consider what for actually you apply this trick and what your readers would think of this method. I personally would feel weird if a site that I visit opens up multiple tabs when I click on a link.

Update: I changed the code a bit because it did not work anymore. Previously there was href=”#” in the code, however, if I add it now, my browser (Firefox) will open three tabs for the link with two sites which the third is this post you are reading. I think it is due to browser compatibility with the code and I don’t think it is because of blogging platform that I use. Previously I used Blogger and Now WordPress. Without the href, the mouse cursor won’t change into hand when hovered on the hyperlink but it does work, at least for me, for now.

Like di Facebook dan Subscribe di YouTube:

Share this:

  • Facebook
  • Telegram
  • Twitter
  • WhatsApp

Artikel Berkaitan:

Filed Under: Blogger Tutorials, HTML Codes, Tutorial Tagged With: code, html

Side Income USD Daripada Paid Surveys

ysense

Reader Interactions

Tinggalkan Balasan Batal balasan

Alamat e-mel anda tidak akan disiarkan. Medan diperlukan ditanda dengan *

Primary Sidebar

Geledah Blog Ini

Artikel Terbaru

  • Pengalaman Test JPJ Motosikal B2
  • Hello Unifi Air, Bye Bye Digi Infinite 150
  • Tukar SIM Card Baru, dan Masalah Baru
  • Cara Untuk Transfer Domain Name Ke Registrar Baru
  • Senarai Saluran TV & Radio Siaran Digital Percuma MYTV / MYFREEVIEW

Paling Banyak Dibaca

  • Renew Lesen L Belajar Memandu LDL Di Pejabat Pos
  • Pengalaman Test JPJ Motosikal B2
  • Tukar SIM Card Baru, dan Masalah Baru
  • Remote Astro Rosak, Beli Remote Baru
  • Cara Daftar BSN Online Banking (myBSN)

Kategori

  • Baiki & Ganti (3)
  • Blogging (28)
  • Catatan Harian (74)
  • Pelbagai (1)
  • Senarai (1)
  • Ulasan (5)

Footer

Mengenai Blog Ini

Blog entry rojak ikut suka hati. Sekadar pandangan peribadi dan tutorial berdasarkan pengalaman sendiri. Bukan yang terbaik, tetapi berharap dapat deliver sesuatu yang bermanfaat untuk semua.

Ikuti Di Facebook

Ikuti Di Facebook

Update Terus Ke Dalam Inbox

Masukkan email dan jadilah pembaca terawal blog ini.

Copyright © 2023 · Genesis Sample on Genesis Framework · WordPress · Log in