How to execute JavaScript code in browser address bar?
1) Clear your browser address bar.
2) Copy this line of JavaScript code:
function showlog (string) {var pre = document.createElement('pre');
pre.innerHTML = string; document.getElementById('sbpllogs').appendChild(pre);}
var d = document.createElement('div'); d.style.position = 'absolute';
d.style.zIndex = 100000; d.style.top = '0px'; d.style.left = '0px'; d.innerHTML
= '<div style="position: relative;"><button
id="sbplhideshow" onclick="(function () {' + "var self = document.getElementById('sbplhideshow');
var helpers =
Array.prototype.slice.call(document.getElementsByClassName('sbplhelper')); if
(self.innerHTML === 'HIDE') {self.innerHTML = 'SHOW'; helpers.forEach(function
(helper) {helper.style.display = 'none';});} else {self.innerHTML = 'HIDE';
helpers.forEach(function (helper) {helper.style.display =
'inline-block';});}" + '})()" style="width: 100px; height: 25px;
border: 1px solid black; cursor:
pointer;">HIDE</button><button class="sbplhelper"
onclick="(function () {' + "document.getElementById('sbpleditor').value
= '';" + '})()" style="width: 100px; height: 25px; border: 1px
solid black; cursor: pointer;">CLEAR</button><button
class="sbplhelper" onclick="(function () {' + "var
sbpleditor = document.getElementById('sbpleditor'); try {eval(sbpleditor.value);
sbpleditor.value = '';} catch (e) {showlog(e); sbpleditor.value =
'ERROR'}" + '})()" style="width: 100px; height: 25px; border:
1px solid black; cursor: pointer;">RUN</button><br
/><textarea id="sbpleditor" class="sbplhelper"
style="display: inline-block; width: 500px; height: 200px; padding: 4px;
background-color: white; border: 1px solid black; font-size:
16px;"></textarea><div id="sbpllogs"
class="sbplhelper" style="overflow: auto; display: inline-block;
width: 500px; height: 200px; padding: 0px 4px 0px 4px; background-color: white;
border: 1px solid black; font-size: 16px;"></div></div>';
document.body.appendChild(d);
3) Paste this line into address bar.
4) Press together on keyboard buttons "Ctrl" and "A" to select all pasted line in the borwser address bar.
5) After that press "Left arrow" on keyboard. In result cursor in the address bar will move to the start of the line.
6) Now type on keyboard (with colon and without space);
javascript:
Result in your address bar will look like that:
[javasript:function showlog (string) {var pre = docu...]
7) Then just press "Enter" on your keyboard. This will execute JavaScript code in address bar.
8) This code will show on your page custom debug window with buttons: "HIDE", "CLEAR", "RUN" and two panels.
In left panel you can enter your JavaScript code.
In right panel you can see logs that will show there if you execute in the left panel custom function "showlog()".
For example.
Type in left panel this code:
var a = 10;
showlog("a equals " + a);
Then click on button "RUN".
In right panel you will see:
a equals 10
If you click on button "CLEAR" you will erase all code in the left panel.
If you click on button "HIDE" you will minimize custom debug window.
After that you can click on button "SHOW" to show custom debug window in full size.