Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning Javascript function automatically
    primarykey
    data
    text
    <p>I have found a javascript function that inverts colors on webpage:</p> <pre><code>String javascript = "javascript: (function (){var newSS, styles = '* { background-color: black ! important; color: green !important; }a:link, a:link * { color: green !important; text-style: underline; }a:visited, a:visited * { color: #7f0000 !important; }a:hover, a:hover * { color: red !important; }';var elemHead = document.getElementsByTagName(\"head\")[0];var elemCSS = document.getElementById(\"darkenCSS\");if (elemCSS){elemHead.removeChild(elemCSS);}else{newSS = document.createElement('link');newSS.rel = 'stylesheet';newSS.href = 'data:text/css,' + escape(styles);newSS.id = \"darkenCSS\";elemHead.appendChild(newSS);}})();"; </code></pre> <p>Is it possible to run this automatically? By that I mean load www.google.co.uk and apply this javascript function.4</p> <p>Hope that makes sense, I don't know much about javascript.</p> <p>CLARIFICATION:</p> <p>I want to know if this javascript function can be appended to a URL at all. Something like <a href="http://www.google.com/?Javascript_blah_blah_blah" rel="nofollow">http://www.google.com/?Javascript_blah_blah_blah</a></p> <p>FURTHER CLARIFICATION:</p> <p>I am making a basic web browser in Android. I want to invert colours on the webpage. I have made a button, that executes this javascript on the page. This works. But needs the user to press the button each time.</p> <p>I want to make a switch to make permanently inverted.</p> <p>So I need to browse to the url input and have it invert the colours automatically.</p> <p>Hope this helps </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload