Questions tagged [evaluatejavascript]
28 questions
4
votes
1 answer
WKWebView evaluateJavaScript returns wrong JavaScript Object
I'm making a hybrid app and using WKWebView.
I need to pass a JavaScript Object to the emitter command to open the edit dialog.
Here is my code:
let statDict: [String: Any] = [
"income" : account.stat.income,
…

andrey leganov
- 101
- 1
- 4
3
votes
4 answers
Evaluate JavaScript returning empty list , but working in PowerShell and CMD
I have two evaluate javascript one is returning a null value and the other is returning an emptylist[1] when the list size is not greater than 0
both of them were giving the output when run in PowerShell with node on the local Windows machine
here…

Vasant Raval
- 257
- 1
- 12
- 31
3
votes
1 answer
Handle Promise from Android WebView with evaluateJavascript
I'm working with the Android WebView and trying to handle the return of a JavaScript promise from the WebView on the Java side after calling it with evaluateJavascript.
document.java
Button buttonAnnotations =…

stonedonkey
- 713
- 1
- 8
- 18
3
votes
1 answer
Flutter Webview or InAppWebview does not evaluate javascript each time
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid) {
await…

Learn IT
- 31
- 2
2
votes
1 answer
WebView communication with iOS application using evaluateJavaScript Holds security risk
I am using Webview on an application for some of the views we show.
I have been tasked with finding a way to listen back to the native platform response, in this case, the iOS system.
My iOS developer shows me a POC using evaluateJavaScript ref…

user24136
- 135
- 4
- 13
2
votes
1 answer
Fatal error while using evaluateJavaScript on WKWebView
WKWebView crashes while trying to evaluate JavaScript on Xcode 14.1, using Swift, tested on iOS but same behaviour should be on macOS.
I made a vastly simplified example to try to find a solution, and it keeps crashing:
let webView =…

vicegax
- 4,709
- 28
- 37
2
votes
1 answer
WKWebView - evaluate JavaScript without seeing changes
In my SwiftUI App, i used a WKWebView to update some html tags from native side, using SwiftUI TextFields. To get the communication working, i am using the evaluateJavaScript() method to send data from native to webview.
My code looks like…

Niklas
- 1,638
- 4
- 19
- 48
2
votes
0 answers
How to evaluateJavaScript when app goes to background WKWebView?
I am create html page with HTML5 IMA SDK player and then load this page to WKWebView, all work fine pause, playing content etc, but I want "pause" content when app goes to background for achieve this I did tried used "WKWebView evaluateJavaScript"…

Ice
- 680
- 1
- 10
- 23
1
vote
0 answers
How does Android implement evaluateJavascript?
I hope to know some implementation details of WebView's evaluateJavascript. How does WebView execute the injected JavaScript code and return the result back to the Java part?
For example, suppose I use this API to execute jsCode and then receive the…

Richard Hu
- 811
- 5
- 18
1
vote
1 answer
Window webkit failure postMessage iOS Swift
I am trying to create a library that open a web view in a class, where the objetive is opened it but does not see it in the screen. I created and try to execute a javaScript that makes a postMessage, to obtain the result for example in the method…

david vargas
- 163
- 1
- 2
- 7
1
vote
1 answer
xamarin.android webview evaluatejavascript It does not return any value at all
I have a fundamental problem that I can not really understand where the problem comes from.
I am designing a project by xamarin.android webview.
Now I need to run a Java function in Web View and check the return value in a if function.
I searched…

Morteza.Zaker
- 11
- 2
1
vote
1 answer
nested stringByEvaluatingJavaScript in UIWebview migrate to WKWebview
In UIWebview implementation I had something like:-
if let pageBody = webView?.stringByEvaluatingJavaScript(from: "document.body.innerHTML") {
if pageBody.contains("xyz") {
return…

ShaluRaj
- 67
- 6
1
vote
1 answer
How to run javascript in a webview from Swift
I need my swift class to interact with the html and javascript in a wkwebview that it references, in particular, feed it a variable.
I thought I would start simply by trying to get the webview to fire an alert:
Here is the code:
let webView =…

user6631314
- 1,751
- 1
- 13
- 44
1
vote
0 answers
How to use webView.evaluateJavaScript in Swift
I need my swift class to interact with the html and javascript in a wkwebview that it references, in particular, feed it a variable.
I thought I would start simply by trying to get the webview to retrieve something using getElementByID following the…

user6631314
- 1,751
- 1
- 13
- 44
1
vote
2 answers
How to load CSS file by using URL in WKWebView
I want to inject CSS by using URL link ,
Working
Working below code, If I store CSS file in Bundle path of project,
lazy var webView: WKWebView = {
guard let path = Bundle.main.path(forResource: "style", ofType: "css") else {
return…

Jaywant Khedkar
- 5,941
- 2
- 44
- 55