Injecting javascript into page via url
<p>I'm trying to run a javascript code via url to change values of the form in the page.
Here is the content of the HTML page.</p>

<pre><code>&lt;html&gt;
&lt;body&gt;
&lt;form method='post'&gt;
Name: &lt;input type='text' id='name' value='' /&gt;&lt;br /&gt;
Family: &lt;input type='text' id='family' value='' /&gt;&lt;br /&gt;
Email: &lt;input type='text' id='email' value='' /&gt;&lt;br /&gt;
&lt;input type='submit' value='Submit' /&gt;&lt;br /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Now, I enter the following value in the URL section of chrome:</p>

<pre><code>javascript:document.getElementById('name').value = 'string1';
</code></pre>

<p>What happens is my whole page will go blank and only the value "string1" will be displayed in the page.
However, running the following code works properly:</p>

<pre><code>javascript:document.getElementById('name').value = 1;
</code></pre>

<p>It will change the value of the name field to 1.
I'm wondering what is causing this problem.</p>

<p>Note: The purpose of this work is to inject code into webview in android.</p>

<p>Any advice is appreciated.</p>