I share here some recent learning about how to make links in the popup of Chrome extension directly clickable.
Problem description
In the Popup window of a Chrome extension, the links are not directly i.e with normal left-mouse-button click clickable.
If you left-click on a link in the popup nothing happens.
Solution
I have found the solution in StackOverflow here: https://stackoverflow.com/questions/8915845/chrome-extension-open-a-link-from-popup-html-in-a-new-tab
It requires jquery.
- Add to popup.html in the head section<script src="jquery-3.7.1.min.js"></script>
- Add to popup.js$('body').on('click', 'a', function(){chrome.tabs.create({url: $(this).attr('href')});return false;});
I have implemented it like this in my Confluence Chrome Extension.
You can then click directly on the search result links to open the corresponding page.
No comments:
Post a Comment