Make a bookmark change and reload the URL of the web page you’re on

Sometimes you just want to get where you’re going on the Web. You don’t want to click three times just to find that URL buried beneath layers of URLs before it. Example: on YouTube you can skip to specific parts of the video by appending the URL with something like “&T=1m10s” to go, for example, to the 1 minute, 10 second point.

Well, I always forget that structure. Maybe you do, too. So to fix that memory problem, here’s some JavaScript and a bookmark that will append “&T=1m10s” to any YouTube video you’re on. (And after that, you can easily change the numbers in the URL of your browser to get to a different point; the goal was to generate a reminder of how to get to specific minute and second locations.)

Here are the three easy steps:

1) Make a .js text file like this:

var randomnumber=Math.floor(Math.random()*11);
var presenturl = window.location.href;
var newurl = presenturl + ‘&t=1m10s’;
window.location.replace(newurl);

2) Upload the .js file to your server.

3) Then make a bookmark, with JavaScript instead of a URL, referencing the .js file. Here’s mine, running off my site:

javascript:(function(){document.body.appendChild(document.createElement(‘script’)).src=’https://hellotumo.com/jswow/yttime2.js’;})();

I am not sure I’ve done this right, but the random number generation starting the .js is meant to force it to refresh each time it is loaded, rather than having the .js get loaded from a browser’s cached files. That means any updates to the .js file will immediately be picked up by anyone using it; or, in other words, web surfers won’t need to clear their cache to get the most recent tweaks to the code.

Finally, why did I discover this at all? Mainly to make using Plone, a CMS, more efficient. In that particular software, getting from an article’s presentation mode to the mode of editing its HTML took two clicks, and a long wait for each click to load. Now I click once and get the HTML editing screen.

2 thoughts on “Make a bookmark change and reload the URL of the web page you’re on”

Leave a Comment

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