Skip to content

Instantly share code, notes, and snippets.

@ricealexander
Last active August 25, 2025 17:39
Show Gist options
  • Save ricealexander/b53ab012a31c655cc14d860da102e9a4 to your computer and use it in GitHub Desktop.
Save ricealexander/b53ab012a31c655cc14d860da102e9a4 to your computer and use it in GitHub Desktop.

Revisions

  1. ricealexander renamed this gist Aug 25, 2025. 1 changed file with 0 additions and 0 deletions.
  2. ricealexander created this gist Jan 4, 2022.
    8 changes: 8 additions & 0 deletions self-injecting-script.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    <!-- Grove and other Single-Page Applications do not allow document.write() to be loaded on
    pages that have been navigated to. In cases where absolutely necessary, we can use an
    approach where content is self-injected. -->

    <script id="embed">
    var script = document.querySelector('#embed');
    script.insertAdjacentHTML('afterend', "Hello World");
    </script>