0

So I have this line of code:

myWebview.loadUrl("javascript:document.getElementById('join_confirm_email').value='[email protected]';void(0);");

for the value inside the javascript injection ([email protected]), I want to use a variable written inside my onCreate method. Is this possible? If it is, how can I do it?

2
  • Please learn string concatenation in JavaScript. This is very simple. Google it. Commented Nov 6, 2015 at 2:46
  • Directly: No. Indirectly: You should use JavaScript Interface to introduce a bridge between Java side and JavaScript side. Commented Nov 6, 2015 at 7:15

1 Answer 1

1

Something like that.

String emailSTR = "[email protected]";
myWebview.loadUrl("javascript:document.getElementById('join_confirm_email').value='"+emailStr+"';void(0);");
Sign up to request clarification or add additional context in comments.

Comments

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.