Need Help With Middle Click Fuction. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need Help With Middle Click Fuction.

forrestcforrestc Posts: 1Member
I have a custom button add-on for Firefox that will go to Facebook in the currently viewing tab and would like to add middle click to open Facebook in a new tab but im not sure how. I looked around and found that I need to use the if (event.button == 4) {...} & window.open(url) but im not sure where to put them to get it to work.
Here is the current JS code.

[code]CustomButton = {

1: function () {const url = "http://www.facebook.com"


document
.getElementById("content")
.webNavigation
.loadURI(url, 0, null, null, null)
},

}[/code]

Thanks for any help and guidance.
Note: If you see anything else wrong with the code, feel free to mention it.
Sign In or Register to comment.