1
クロム拡張機能を開発していて、iframeをGoogleホームページに挿入したいのですが、htmlはプレーンテキストとして表示されます。なぜこれが起こるのですか?ここでウェブページに挿入するとHTMLがプレーンテキストとして表示されます
は、現在、私のコードです:ここでは
manifest.jsonを
{
"manifest_version": 2,
"name": "Google",
"version": "1.0",
"description": "Google iframe",
"icons": {
"48": "img/rsz_apple-touch-icon-144x144.png",
"16": "img/favicon-16x16.png",
"128": "img/rsz_1apple-touch-icon-144x144.png"
},
"content_scripts": [{
"matches": ["https://www.google.com.au/"],
"js": ["content-script.js"]
}],
"browser_action": {
"default_icon": "img/favicon-16x16.png",
"default_title": "Press the button to see more actions",
"default_popup": "popup.html"
},
"background": {
"page": "background.html"
},
"permissions": [
"activeTab"
]
}
コンテンツ-script.js
var div=document.createElement("div");
document.getElementById("searchform").appendChild(div);
div.innerText="<iframe src='https://www.google.com.au/'>ERROR</iframe>";
ありがとうございました。