3

I found it difficult when I want to run javascript in package flutter_inappwebview, Previously I tried with webview_flutter I was able to run runJavascript but there was a problem when I used webview_flutter I could not upload this file for example when I used webview_flutter

final json =
              jsonEncode(TawkVisitor(name: "jhon", email: "[email protected]"));

          String javascriptString;

          javascriptString =
              '''Tawk_API = Tawk_API || {};Tawk_API.onLoad = function() {Tawk_API.setAttributes($json);''';

          await controller.runJavascript(javascriptString);

          setState(() {});

can you guys help how to run javascript in packages flutter_inappwebview

1

1 Answer 1

4

Try this one:

String yourCode = "alert('JS Running')";
controller.evaluateJavascript(source: yourCode).then((result) {
debugPrint(result);
});
Sign up to request clarification or add additional context in comments.

1 Comment

I agree logically it is the same

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.