Href inside a browser (openTab)
Categories
(Thunderbird :: Add-Ons: General, defect)
Tracking
(Not tracked)
People
(Reporter: adrien.rybarczyk, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Steps to reproduce:
- Create a extension with a function call with openTab.
Example : Services.wm.getMostRecentWindow("mail:3pane").document.getElementById("tabmail").openTab - In the html code of the opened page a link with an href containing a javascript call.
Example : <a HREF="javascript:alert('test')">test link</a> - Click on the link
Actual results:
Nothing happens and we get an error in console (2147942487).
Expected results:
The link works.
Comment 1•4 years ago
|
||
The way forward here is to use
https://webextension-api.thunderbird.net/en/91/tabs.html#create-createproperties
| Reporter | ||
Comment 2•4 years ago
|
||
Thank you for the answer. I tried, there was no error in console. But in the case of the example proposed, the alert does not go off.
Comment 3•4 years ago
|
||
There are multiple issues with the example. You should not use javascript href links, but use an eventlistener for the click event to run a javascript function. And alert is probably not allowed for WebExtensions. Use console.log to have a visual feedback when the call has been executed, or use the debugger [1].
For further questions regarding WebExtension programming, please use our other channels [2].
[1] https://extensionworkshop.com/documentation/develop/debugging/
[2] https://developer.thunderbird.net/add-ons/community
Description
•