Open ilyosbekkk opened 3 years ago
👋 @ilyosbekibrohimov
NOTE: This comment is auto-generated.
Are you sure you have already searched for the same problem?
Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!
If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.
In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE]
or ios WKWebView [MY ERROR HERE]
keywords.
Following these steps can save you, me, and other people a lot of time, thanks!
- I have read the Get Started - Installation section
- I have read and done the Get Started - Setup Android section
- I have read and done the Get Started - Setup iOS section
- I have already searched for the same problem
Environment
Technology Version Flutter version 2.0.6 Plugin version flutter_inappwebview: ^5.3.2 Android version
iOS version
Xcode version Device information: I don't think this problem is related to the deviceHello, I was going to implement google sign in functionality (sign in functionality is implemented in web frontend side) inside the webView In the first case, when I tried to sign in to google inside webView, the error was disallowed userAgent: I solved that issue by setting the userAgent to random String After that, I tried again, but this time the error was: access_denied (error code: 403) Here is my code:
`import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { // This widget is the root of your application. @OverRide Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@OverRide _MyHomePageState createState() => _MyHomePageState(); }
class _MyHomePageState extends State { @OverRide Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Container( child: InAppWebView( initialUrlRequest: URLRequest(url: Uri.parse("https://example.com")), initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( javaScriptEnabled: true, userAgent: "random", useShouldOverrideUrlLoading: true, ), android: AndroidInAppWebViewOptions( useHybridComposition: true, ), ios: IOSInAppWebViewOptions( allowsInlineMediaPlayback: true, )), ), ), ); } } ` Thank you in advance:)
Hi I had the same issue some days ago! I fixed it using next configuration: I hope it help you to fix the issue :octocat:
InAppWebView(
key: webViewKey,
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
// debuggingEnabled: true,
userAgent: 'random',
javaScriptEnabled: true,
useShouldOverrideUrlLoading: true,
useOnLoadResource: true,
cacheEnabled: true,
),
),
initialUrlRequest: URLRequest(url: Uri.parse(hppUrlEnum.getUri)),
onWebViewCreated: (controller) {
webViewController = controller;
},
onLoadStart: (controller, url) {
updateLoading(isLoading: true);
},
shouldOverrideUrlLoading: (controller, navigationAction) async {
return NavigationActionPolicy.ALLOW;
},
onLoadStop: (controller, url) async {
updateLoading(isLoading: false);
},
onLoadError: (controller, url, code, message) {
updateLoading(isLoading: false);
},
onProgressChanged: (controller, progress) {},
onConsoleMessage: (controller, consoleMessage) {
debugPrint("consoleMessage: ${consoleMessage.message}");
},
onUpdateVisitedHistory: (controller, url, androidIsReload) {},
),
Environment
Device information: I don't think this problem is related to the device
Hello, I was going to implement google sign in functionality (sign in functionality is implemented in web frontend side) inside the webView In the first case, when I tried to sign in to google inside webView, the error was disallowed userAgent: I solved that issue by setting the userAgent to random String After that, I tried again, but this time the error was: access_denied (error code: 403) Here is my code:
`import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }
class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override _MyHomePageState createState() => _MyHomePageState(); }
class _MyHomePageState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(
child: InAppWebView(
initialUrlRequest:
URLRequest(url: Uri.parse("https://example.com")),
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
javaScriptEnabled: true,
userAgent: "random",
useShouldOverrideUrlLoading: true,
),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
)),
),
),
);
}
}
`
Thank you in advance:)