I'm developing a chrome extension to open links from different columns to their assigned tab. Using Google apps script API to create a context of the sheet inside the chrome extension. But Google apps script API is a long path and I can't avoid opening and closing of tabs on clicking link form sheet.
Now I want to add an event listener for click on sheet link/tooltip link. I am Already using a content script to inject a panel in the sheet.
Here is code from (content script). related to the link.
(function() {
let sheetLinks = document.querySelectorAll('.waffle-hyperlink-tooltip-link');
for (let i = 0; i < link.length; i++) {
sheetLinks[i].addEventListener("click", sendHref);
}
function sendHref(e) {
e.preventDefault()
console.log('link was clicked')
}
})()
By hovering over google sheet link we can click a link in a tooltip. there I want to prevent-default and send Href by chrome message to background script.and from there I can update tabs URL.
from How can I add event Listener to google sheets link in chrome extension's content script?
No comments:
Post a Comment