0

I don't know html and javascript and need to start some certain function from javascript.

I've found that you can start some javascript function simply by myWebView.loadUrl("javascript:function()"); if it's within html. But I've got a bunch of htmls in my raw folder and a separate script.js file which works with all that htmls. I need to start a function from this script.js - so what do I do for that?

1 Answer 1

0

Put your javascript.js file in the same folder (raw) as your html files are. Then inside the <head> tag of your html files import your javascript files (if it is imported already, check if the src path inside the <script> tag is correct), something like this:

<script type="text/javascript" src="javascript.js" ></script>

Doing so, you load in your html, all the javascript functions contained in your javascript.js file and you can call myWebView.loadUrl("javascript:function()"); successfully.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.