How to open a link in new tab using javascript

前端 未结 5 1384
醉话见心
醉话见心 2021-01-02 04:31

I am working on a website, in which I have to open a url from backend. I am using c# now. My problem is that I want to open link in new tab instead of new window.

M

5条回答
  •  清歌不尽
    2021-01-02 04:58

    I think answer to this question will help , Open a URL in a new tab using JavaScript https://stackoverflow.com/a/30512485/2293686

    try like this,

    $('#myButton').click(function () {
        var redirectWindow = window.open('url', '_blank');
        redirectWindow.location;
    });
    

提交回复
热议问题