The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,224 other subscribers

I want to check out how to do POST requests using bookmarklets in order to save URLs to the WayBack machine

Posted by jpluimers on 2023/04/27

I want to check out how to do POST requests using bookmarklets in order to save URLs to the Wayback machine.

The reason is that every few months or so, saving a page the normal way through a something like fails for one reason or the other, but going to, then entering URL, and pressing “SAVE PAGE” button works fine:

The the failing way above is using a GET request, the succeeding workaround will open  using the below POST request (where I omitted some HTTP cookies and HTTP header fields for brevity).

  • POST request using PowerShell:
    $session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
    $session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
    Invoke-WebRequest -UseBasicParsing -Uri "" `
    -Method "POST" `
    -WebSession $session `
    -Headers @{
    } `
    -ContentType "application/x-www-form-urlencoded" `
    -Body "url=URL&capture_outlinks=on&capture_all=on&capture_screenshot=on"
  • POST request using cURL on bash:
    curl '' \
      -H 'origin:' \
      -H 'content-type: application/x-www-form-urlencoded' \
      -H 'referer:' \
      --data-raw 'url=URL&capture_outlinks=on&capture_all=on&capture_screenshot=on' \
  • POST request using the fetch API in JavaScript:
    fetch("", {
      "headers": {
        "content-type": "application/x-www-form-urlencoded",
      "referrer": "",
      "body": "url=URL&capture_outlinks=on&capture_all=on&capture_screenshot=on",
      "method": "POST",
      "mode": "cors"

BTW: Yes, I know that URL is not a valid URL, so it will return a page with “http://url/ URL syntax is not valid.“.

All links below via [Wayback/Archive] bookmarklet post request – Google Search:

I tried to put createFormSubmittingBookmarklets/createFormSubmitBookmarklets.js in a bookmarklet using both and That failed: somehow this code does not want to run as bookmarklet.

Running it from the console is fine though, and gave me this basic bookmarklet template:

javascript:function sf(ur,ty,fd){function me(tg,pr){var el=document.createElement(tg);for(const[nm,vl]of Object.entries(pr)){el.setAttribute(nm,vl);}return el}const fm=me("form",{action:ur,method:ty,style:"display:hidden;"});for(const[nm,vl]of Object.entries(fd)){fm.appendChild(me("input",{name:nm, value:vl}))}document.body.appendChild(fm);fm.submit()}sf("","post",{"url":"URL","capture_outlinks":"on","capture_all":"on","capture_screenshot":"on","wm-save-mywebarchive":"on","email_result":"on","":"SAVE PAGE"});

There bold URL there is the URL to be saved. I need to test this, then rework it to become parameterised.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: