javascript - Firefox extension panel doesn't execute html code -
hi i'm trying create panel in firefox extension in html code dinamically inserted javascript code. code:
var { togglebutton } = require('sdk/ui/button/toggle'); var panels = require("sdk/panel"); var htmlpage = '<html><head><link href="panel-style.css" type="text/css" rel="stylesheet"></head>' + '<body><form>what name?: <input id="user-real-name" placeholder="insert here name"/><br />' + '<input type="button" value="submit" id="submit-btn"/></form><script src="get-text.js"></script>' + '</body></html>'; var button = togglebutton({ id: "button", label: "tmp button", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onchange: handlechange }); var panel = panels.panel({ width: 200, height: 100, contenturl: "data:text/html," + htmlpage, onhide: handlehide }); function handlechange(state) { if (state.checked) { panel.show({ position: button }); } } function handlehide() { button.state('window', {checked: false}); } panel.on("show", function() { panel.port.emit("show"); }); panel.port.on("text-entered", function (text) { console.log(text); panel.hide(); });
but html code not executed....the panel built html code doesn't call "get-text.js" script. using external file html , "contenturl: data.url("panel.html")" code extension work well. have solution? lot.
i solved.....the problem solved inserting line in panel's code:
contentscriptfile: data.url("get-text.js"),
Comments
Post a Comment