Skip to content

Instantly share code, notes, and snippets.

@kevlened
Last active May 25, 2024 05:11
Show Gist options
  • Save kevlened/357d1b8c614d9dac9e1c772e3fb79ea2 to your computer and use it in GitHub Desktop.
Save kevlened/357d1b8c614d9dac9e1c772e3fb79ea2 to your computer and use it in GitHub Desktop.
Edit page

steps:

  1. bookmark the current page (in Chrome, you can drag the lock next to the url to the bookmarks bar)
  2. right-click the bookmark
  3. click Edit...
  4. change the url to the following (copy/paste)
javascript:(()=>{function t(e){e.body?.toggleAttribute("contenteditable");let n=e.getElementsByTagName("iframe");for(let o of n)try{t(o.contentWindow.document)}catch(c){}}t(document)})();
  1. save
  2. click the "Edit page" bookmark when you want to edit a page

Original code:

(() => {
  function change(doc) {
    doc.body?.toggleAttribute('contenteditable')
    const iframes = doc.getElementsByTagName('iframe')
    for (const iframe of iframes) {
      try {
         change(iframe.contentWindow.document)
      } catch (e) {}
    }
  }

 change(document)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment