D
D
doctorsteep2020-01-02 23:39:42
JavaScript
doctorsteep, 2020-01-02 23:39:42

How to embed script in WebView-Android?

How to add js to WebView without disturbing the site so that nothing breaks. If added via web.loadUrl("javascript:****"); - this is not the case, and at the same time, the Google page breaks (all Google applications cease to be displayed). Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2020-01-03
Hasanly @azerphoenix

Good afternoon!

How to add js to WebView without disturbing the site so nothing breaks

Most likely you know that js code is executed on the client, so if the code is written correctly, then nothing should break
If added via web.loadUrl("javascript:****"); - this is not the case, and at the same time, the Google page breaks (all Google applications cease to be displayed).

This means that there are problems in your js code, or it is connected at the wrong time. For example, the script should fire after DOM Content loaded
https://stackoverflow.com/questions/8533187/add-ja...
https://developer.android.com/guide/webapps/webview

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question