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 1,860 other subscribers

Archive for May 31st, 2023

JavaScript bookmarklet to replace part of the archive.li fixing: not possible 

Posted by jpluimers on 2023/05/31

Quite often while saving a URL in the WayBack Machine, the response often is headed “Sorry” with non-descriptive “Job failed”. In the background however, at least half of th…

Related: JavaScript bookmarklet to replace part of the WayBack machine URL

For instance, a while ago for instance http://archive.fo/search/?q=nu.nl, https://archive.fo/search/?q=nu.nl and similar URLs redirected to https://archive.li/search/?q=nu.nl, which in turn redirected to itself:

This page isn’t working

archive.li redirected you too many times.

ERR_TOO_MANY_REDIRECTS

This isn’t a cookie thing as it happens in an anonymous window on several browsers as well. Most redirect checkers return a 429, as Archive Today has quite strict rate limiting:

I tried these bookmarklets to go to a good archive.is link from the above replacing http://archive.fo/search/?q=nu.nlhttps://archive.fo/search/?q=nu.nl, http://archive.li/search/?q=nu.nl and https://archive.li/search/?q=nu.nl with https://archive.is/search/?q=nu.nl (with the same above bolded parts):

javascript:(function() {window.location=window.location.toString().replace(/^http.?:\/\/archive\.[is|li]\//,'https://archive.is/');})()

It can even be simpler (but maybe not fully conformant to specs):

javascript:location=location.href.replace(/^http.?:\/\/archive\.[is|li]\//,'https://archive.is/')

These both fail!

Even a simple bookmarklet like this fails too:

javascript:alert('hello world!');

It took me a bit of thinking to figure out why, but then figured out that any JavaScript requires a page context to run, and when no page is displayed, there is no context to run on.

And indeed:

–jeroen

Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers | Leave a Comment »