MozillaZine

why location.href="javascript:. doesn't work for extensions?

Discussion of bugs in Mozilla Firefox
lastornot
 
Posts: 9
Joined: September 25th, 2015, 6:07 pm

Post Posted March 3rd, 2017, 5:44 am

I need to call web-site's js function (site owns this function) from Firefox Web Extensions

For Chrome web-browser extensions I can use the next line:

Code: Select all
location.href="javascript:SomeFunction(); void 0";

Works great.

But it doesn't work for Firefox

Also in old addons for FF I could call the web-site's js function like this:

Code: Select all
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                  .getService(Components.interfaces.nsIWindowMediator);
var mainWindow = wm.getMostRecentWindow("navigator:browser");
mainWindow.gBrowser.loadURI("javascript:SomeFunction(); void 0");


But now I need this in Firefox Web Extensions (like Chrome extensions)

Any ideas?

Return to Firefox Bugs


Who is online

Users browsing this forum: No registered users and 4 guests