Javascript - Open a given URL in a new tab by clicking a button

前端 未结 13 460
一生所求
一生所求 2020-12-04 13:35

I would like to have a button that redirects to a given URL and opens in a new tab. How can this be done?

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 14:19

    My preferred method has the advantage of no JavaScript embedded in your markup:

    CSS

    a {
      color: inherit;
      text-decoration: none;
    }
    

    HTML

    
    

提交回复
热议问题