You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I tried to inject a js file with the webviewcontroller.injectScriptFile(String urlFile) of the flutter_inappbrowser package in Flutter to an open InAppBrowser website. Actually my function in the js file that should be injected should automatically run when it is injected but it does not. There might be nothing wrong with my js file so it has to be the way on how I try to inject the file by the path or something.
I tried the following: 1. I added my whole assets folder to be recognized by flutter in pubspec.yaml 2. My locale path to the js file is assets/js/example.js so I tried to give exactly this path to the parameter as a string. 3. I also tried to change my js file that there is a normal function and export it. And call this function with webviewcontroller.injectScriptCode("functionFromJsFile()") but error is functionFromJsFile() is not defined
EXAMPLE.JS:
(function() {
alert("Test");
})();
CODE TO INJECT FILE INSIDE CLASS THAT EXTENDS INAPPBROWSER (The own class works as expected. Only the given line in onLoadStop does not.):
I actually expect that when I then call the function to open the InAppBrowser the InAppBrowser opens the given website and bring me the alert. Everything works except the alert that comes from my given js file but js file is not even injected or something is wrong with the parameter urlFile which in my case is "assets/js/example.js"
The text was updated successfully, but these errors were encountered:
Also, this plugin changed its name to flutter_inappwebview. The current latest version now is 2.1.0+1. So, you can change your dependency influtter_inappwebview: ^2.1.0+1.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.
Hi I tried to inject a js file with the
webviewcontroller.injectScriptFile(String urlFile)
of theflutter_inappbrowser
package in Flutter to an open InAppBrowser website. Actually my function in the js file that should be injected should automatically run when it is injected but it does not. There might be nothing wrong with my js file so it has to be the way on how I try to inject the file by the path or something.Here are the docs for the flutter_inappbrowser package: https://pub.dev/packages/flutter_inappbrowser
I tried the following: 1. I added my whole assets folder to be recognized by flutter in pubspec.yaml 2. My locale path to the js file is assets/js/example.js so I tried to give exactly this path to the parameter as a string. 3. I also tried to change my js file that there is a normal function and export it. And call this function with
webviewcontroller.injectScriptCode("functionFromJsFile()")
but error isfunctionFromJsFile() is not defined
EXAMPLE.JS:
CODE TO INJECT FILE INSIDE CLASS THAT EXTENDS INAPPBROWSER (The own class works as expected. Only the given line in onLoadStop does not.):
CODE FOR OPENING THE INAPPBROWSER:
I actually expect that when I then call the function to open the InAppBrowser the InAppBrowser opens the given website and bring me the alert. Everything works except the alert that comes from my given js file but js file is not even injected or something is wrong with the parameter
urlFile
which in my case is"assets/js/example.js"
The text was updated successfully, but these errors were encountered: