By searching here, I now have two bookmarklets, which switch from/to HTTP/HTTPS :-
javascript:location=location.href.replace(/http:/g,"https:")
And ...
javascript:location=location.href.replace(/https:/g,"http:")
But is there a way, please, to combine them into a single bookmarklet, which will toggle from one to the other according to whichever is presently loaded?
This thread is a little old, but I haven't found a better answer anywhere else.
javascript:((function(){window.location=location.href.replace(/^http/i,"https").replace(/^http\w{2,}/i,"http");})())
is fully formed bookmarklet code that should work in any browser.
location.href.replace(/^http/i,"https").replace(/^http\w{2,}/i,"http")
if (window.location.protocol == 'http:') window.location.protocol = 'https:'
else window.location.protocol = 'http:'
Then all you'd need to do is format that as a bookmarklet. Enjoy!