<browser id="search" type="content-targetable" src="www.google.com">
</browser>
Javascript Code
// I am using script to set the property of browser element
var x=document.getElementById('search');
x.docshell.allowAuth="false" // The code stops here
x.docshell.allowPlugin="false" //This does not work
As with many XUL tags, the <browser>
tag isn't inherently "special" - the "special" functionality is added by XBL . The important thing is that XBL bindings are added via CSS rules and for these CSS rules to apply the element has to be inserted into the document. So it is important to insert the element first and only access the special properties after that. Of course, in this case some asynchronous initialization might be required as well so you better do something like:
var browser = document.createElement(browser);
parent.appendChild(browser);
window.setTimeout(initBrowser, 0);
function initBrowser()
{
x.docShell.allowAuth = false;
...
browser.loadURI("...", null, null);
}
Note that it's docShell
(your example used wrong captalization) and that allowAuth
is a boolean, not a string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.