 <p>A quick way to do it would be if your javascript code is embedded in a php file (not an external link to a .js file), you could just do a PHP print right in between your <code>&lt;script&gt;&lt;/script&gt;</code> tags. It would work with bookmarks and pasting the URL to the address bar.</p> <p>For example:</p> <pre><code>&lt;script type="text/javascript"&gt; var get_var; get_var = &lt;? print $_GET['varname']; ?&gt;; // some jQuery code here &lt;/script&gt; </code></pre> <p><strong>This should only be used as a proof of concept.</strong> This is vulnerable to <a href="https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29" rel="nofollow">XSS attacks</a>, and should not be used in production. This <a href="https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet" rel="nofollow">list of XSS prevention techniques</a> is a good place to start (but outside the scope of the OP's question). </p>