0

srcなしでiframeの内容を変更したい。だから私は試します

var doc = findIframe().get(0).contentWindow.document;
    doc.open();
    doc.write(GM_getResourceText('iframe.html'));
    doc.close();

iframe.html の内容:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>iframe</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <style type="text/css">some style</style>
        <script> some script</script>
    </head>
<body>
</body>
</html>

ただし、iframe head の代わりにすべての要素が iframe body に追加されます。メインウィンドウからスクリプトを実行します。どうすれば解決できますか?

4

0 に答える 0