snipt

Ctrl+h for KB shortcuts

JavaScript

http2https bookmarklet

javascript:(function(){ if (location.href.indexOf("http") !== -1) { location.href = location.href.replace("http", "https"); } })();
https://snipt.net/embed/7c0cd0858956ac7022a1731c8d34dc87/
/raw/7c0cd0858956ac7022a1731c8d34dc87/
7c0cd0858956ac7022a1731c8d34dc87
js
JavaScript
1
2019-06-04T12:54:35
True
False
False
/api/public/snipt/23249/
http2https-bookmarklet
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">javascript</span><span class="o">:</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span> <span class="k">if</span> <span class="p">(</span><span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s2">&quot;http&quot;</span><span class="p">)</span> <span class="o">!==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span> <span class="nx">location</span><span class="p">.</span><span class="nx">href</span> <span class="o">=</span> <span class="nx">location</span><span class="p">.</span><span class="nx">href</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="s2">&quot;http&quot;</span><span class="p">,</span> <span class="s2">&quot;https&quot;</span><span class="p">);</span> <span class="p">}</span> <span class="p">})();</span> </span></pre></div> </td></tr></table>
bookmarklet, https, javascript