I am developing an addon for Firefox. In a content script file I have the line
angular.element(document.getElementById("angularAppDiv")).scope();
it returns null
. However if I type the same line into the browser console, I get the scope object? Could someone point out what's happening and why?
By default, content scripts loaded by add-ons and scripts loaded by web pages are insulated from each other:
What you could do is to insert this script tag from content script into the page:
document.head.innerHTML = document.head.innerHTML + '<script> console.log(angular.element(document.getElementById("angularAppDiv")).scope());</script>';
Check this link for more info.
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.