Note that there are some explanatory texts on larger screens.

plurals
  1. POuncaught referenceerror function is not defined javascript android
    primarykey
    data
    text
    <p>I try to load html page to custom webView also i need to load 4 javascript files to the webView, when i put the javascript reference in the head tag in html directly, they worked well, but when i load them at run time from my android function, they loaded correctly, but dont work and catch "uncaught referenceerror function is not defined" exception.</p> <p>here is what i do in two status:</p> <p>status 1: load reference directly:</p> <p>this works perfectly.....</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;head&gt; &lt;script type="text/javascript" src="file:///android_asset/selection/android.selection.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="file:///android_asset/selection/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="file:///android_asset/selection/rangy-core.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="file:///android_asset/selection/rangy-serializer.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; ...... &lt;/body&gt; &lt;/html&gt; </code></pre> <p>status 2: load from android application in webview client,,, onPageFinished method i put this code:</p> <pre><code>String str = "javascript: (function() { " + " var rangycore=document.createElement('script');" + " rangycore.type='text/javascript';" + " rangycore.src='file:///android_asset/selection/rangy-core.js';" +"document.getElementsByTagName('head').item(0).appendChild(rangycore);" + " var rangyserializer=document.createElement('script');" + " rangyserializer.type='text/javascript';" + " rangyserializer.src='file:///android_asset/selection/rangy-serializer.js';" + " document.getElementsByTagName('head').item(0).appendChild(rangyserializer);" + " var select=document.createElement('script');" + " select.type='text/javascript';" + " select.src='file:///android_asset/selection/android.selection.js';" + " document.getElementsByTagName('head').item(0).appendChild(select);" + " var jquery=document.createElement('script');" + " jquery.type='text/javascript';" + " jquery.src='file:///android_asset/selection/jquery.js';" + " document.getElementsByTagName('head').item(0).appendChild(jquery);})()"; BTWebView.this.loadUrl(str); </code></pre> <p>this print console message "uncaught referenceerror: rangy is not defined" although the head tag appended correctly with the scripts string.</p> <p>how i can solve this problem and thank you....</p>
    singulars
    1. This table or related slice is empty.
    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. 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