Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could try...</p> <pre><code>function evalMe(code){ var script = document.createElement('script'); script.innerText = code; document.querySelector('head').appendChild(script); } </code></pre> <p>This should create the same effect, unless they have disabled it as well, but from my knowledge this is fine. Of course if the script <code>errors</code> you will not hear about it unless you do some wrapping of the <code>string</code> to <code>eval</code> e.g.</p> <pre><code>function myHandler(err){ // handle errors. } function evalMe(code){ var script = document.createElement('script'); var wrapper = '(function(){ try{ @@ }catch(err){ myHandler(err); } })()'; // Make sure the string has an ending semicolon code = code[code.length-1] === ';' ? code : code + ';'; script.innerText = wrapper.replace('@@', code); document.querySelector('head').appendChild(script); } </code></pre> <p>Alternately you could use the official mechanism</p> <p><a href="http://developer.chrome.com/beta/extensions/tabs.html#method-executeScript" rel="nofollow">http://developer.chrome.com/beta/extensions/tabs.html#method-executeScript</a> </p> <p>However this would require you to have a <a href="http://developer.chrome.com/extensions/background_pages.html" rel="nofollow">background page</a> and employ <a href="http://developer.chrome.com/extensions/messaging.html" rel="nofollow">message passing</a> between your <code>app</code> page and the background page.</p> <p><strong>UPDATE:</strong> Working Method</p> <p>You can create an <code>eval</code> like method using an iframe and a <code>base64</code> encoded <code>dataURI</code> that handles message passing between the extension page and the <code>&lt;iframe&gt;</code>. You can grab a working copy of the <a href="https://github.com/AshHeskes/eval-extension" rel="nofollow">code on github</a>. To use simply clone or download the repo, and install the 'client' <code>dir</code> as an unpackaged extension in the chrome extension manager. The code driving the plugin resides in <code>app.js</code></p> <p>Use the iframeEval to test, the error notification is a little buggy but hey, the <code>eval</code> works.</p> <p>@appsillers In order to get your plugin working without any additional code, you could overwrite the <code>eval</code> method on you extensions <code>window</code> with the <code>iframeEval</code> method in the code.</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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      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