If you have an HTML button, you can use the following JavaScript code to open a desired URL in a new tab when user clicks the button. Remember, this method will open either a new tab or a new window depending upon the default settings of the user’s browser. However, nowadays, all the browsers provide multi-tab view and the default is to open a new tab. If you want to open a link in a new tab –the easiest way is to use target attribute of ANCHOR element in HTML. Here is how you need to do it. SEE ALSO: Open Recently Closed Tabs in Chrome Tip 1: Here the target attribute is set to _blank. This value opens a new tab/window. If you are using a frame in your webpage (iframe or frameset) you can give name of the frame as target value to open the URL in that particular frame. For example: Tip 2: Target attribute can also to use to open a link from inside a frame into the entire tab (this is called frame breaking). To do so, just give _top as the value of target attribute. And voila! Link will break the frame and open in the whole tab. TIP 3: If you want, you can also use CSS to stylize your link to look like a button. I hope this tip was useful for you. Please let me know if you have any questions in this regard. Thank you for using TechWelkin! Very nice information. These all above method work perfect for normal link. I’m looking for applying this technique on Alexa Widget. I tried it, but it is not working. Can you please have a look? Thanks & Regards, Gulshan Comment * Name * Email * Website

Δ

Javascript  Open New Tab and Link onClick of HTML Button - 46