replacing innerHTML removes HEAD and BODY tags - Mozilla

This is a discussion on replacing innerHTML removes HEAD and BODY tags - Mozilla ; Hello, My extension is a simple button that, when pushed, replaces all of the content of a web page. Problem is, when the HTML gets inserted, the HEAD and BODY tags seem to disappear. Here is a brief example: function ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: replacing innerHTML removes HEAD and BODY tags

  1. replacing innerHTML removes HEAD and BODY tags

    Hello,

    My extension is a simple button that, when pushed, replaces all of the
    content of a web page. Problem is, when the HTML gets inserted, the
    HEAD and BODY tags seem to disappear. Here is a brief example:

    function parsePage () {
    window.content.document.documentElement.innerHTML =
    "some stufffoo";
    }


    Resulting rendered source is:

    <br /> some stuff<br />
    foo


    Anyone have a clue to what's happening here?

    Thanks in advance,

    John


  2. Re: replacing innerHTML removes HEAD and BODY tags

    On Jul 13, 12:11 pm, john wrote:
    > Hello,
    >
    > My extension is a simple button that, when pushed, replaces all of the
    > content of a web page. Problem is, when the HTML gets inserted, the
    > HEAD and BODY tags seem to disappear. Here is a brief example:
    >
    > function parsePage () {
    > window.content.document.documentElement.innerHTML =
    > "some stufffoo";
    >
    > }
    >
    > Resulting rendered source is:
    >
    > <br /> > some stuff<br /> >
    > foo
    >
    > Anyone have a clue to what's happening here?
    >
    > Thanks in advance,
    >
    > John


    Incidently, this is repeatable using the Shell bookmarklet as:
    window.document.documentElement.innerHTML = "some<br /> stuff foo";

    viewing the rendered source via "view source chart".
    J


+ Reply to Thread