title: Execute Inline JavaScript code within IFrame src attribut
body: <p>Is it possible to execute inline JavaScript code on src attribute of an existing IFrame (function that do some logic and return an url ) ?</p>
  
  <p>When I try the code, I get the error : Uncaught ReferenceError: hello is not defined</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;title&gt;title&lt;/title&gt;
   &lt;script type="text/javascript"&gt;
    var hello = function(src1){
              // some logic goes here
     return "www.mysite.com";
    } 
   &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   
   &lt;iframe width="400" height="400" src="javascript:hello()"   &gt; 
   &lt;/iframe&gt;
   
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>