Wien.Mart Member Licensed User Longtime User Apr 10, 2014 #1 I have a problem with passing variables to javascript.js files. I am able to load the .js files as there are examples available. The .js files have functions in them, like uname, pwd and svrname functions. For the .js to work, I need to pass value to them. The server name is more like a url to connect to. How do I do that? Please help me. Thanks in advance. Function like: SendReceive(Server, UserId) Read(Server, UserId) Last edited: Apr 10, 2014
I have a problem with passing variables to javascript.js files. I am able to load the .js files as there are examples available. The .js files have functions in them, like uname, pwd and svrname functions. For the .js to work, I need to pass value to them. The server name is more like a url to connect to. How do I do that? Please help me. Thanks in advance. Function like: SendReceive(Server, UserId) Read(Server, UserId)
warwound Expert Licensed User Longtime User Apr 11, 2014 #2 Assuming that you're loading these javascript files along with a webpage in a WebView you can execute javascript using the WebView LoadUrl method: Code: Copy Dim Javascript As String Dim Server As String="Some value" Dim UserId As String="Some value" Javascript="javascript:SendReceive('"&Server&"', '"&UserId&"')" Log(Javascript) MyWebView.LoadUrl(Javascript) You ideally want to only execute such javascript after the webpage has loaded so add a sub to your project that listens for the WebView PageFinished (Url As String) event and execute the javascript after that event has been raised. Martin. Upvote 0
Assuming that you're loading these javascript files along with a webpage in a WebView you can execute javascript using the WebView LoadUrl method: Code: Copy Dim Javascript As String Dim Server As String="Some value" Dim UserId As String="Some value" Javascript="javascript:SendReceive('"&Server&"', '"&UserId&"')" Log(Javascript) MyWebView.LoadUrl(Javascript) You ideally want to only execute such javascript after the webpage has loaded so add a sub to your project that listens for the WebView PageFinished (Url As String) event and execute the javascript after that event has been raised. Martin.
Wien.Mart Member Licensed User Longtime User Apr 12, 2014 #3 Dear Martin, Thank you for the reply. I will test and let you know. Warm regards, Martin Upvote 0