Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shouldOverrideUrlLoading not triggering on goBack() function - Android #2509

Open
1 task
grove86dipesh opened this issue Jan 22, 2025 · 1 comment
Open
1 task
Labels
bug Something isn't working

Comments

@grove86dipesh
Copy link

grove86dipesh commented Jan 22, 2025

Current Behavior

I load web Url without set header on InAppWebView then, will goto inner pages and click on login button. after login, set header(login token) on URLRequest and load WebView it's work fine but, issue is when calling goBack() method that time shouldOverrideUrlLoading() method not trigger and I can't able to set header on previous pages. In iOS shouldOverrideUrlLoading() trigger when I called goBack() method.

Expected Behavior

When goBack() method calling on android it should be calling shouldOverrideUrlLoading() method.

Steps with code example to reproduce

Steps with code example to reproduce
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class WebViewWidget extends StatefulWidget {
  const WebViewWidget({super.key});

  @override
  State<WebViewWidget> createState() => _WebViewWidgetState();
}

class _WebViewWidgetState extends State<WebViewWidget> {
  final GlobalKey webViewKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      child: InAppWebView(
        key: webViewKey,
        onWebViewCreated: (controller) {
          controller.loadUrl(
              urlRequest: URLRequest(
                  url: WebUri(
                      "https://inappwebview.dev/docs/webview/in-app-webview")));
        },
      ),
    );
  }

  @override
  void dispose() {
    debugPrint("WebViewPage dispose called.");
    super.dispose();
  }
}

Stacktrace/Logs

Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>

Flutter version

v3.27.2

Operating System, Device-specific and/or Tool

Flutter doctor

/Users/dipeshjethwa/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.27.2, on macOS 15.2 24C101 darwin-arm64, locale en-IN)
• Flutter version 3.27.2 on channel stable at /Users/dipeshjethwa/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 68415ad1d9 (3 days ago), 2025-01-13 10:22:03 -0800
• Engine revision e672b006cb
• Dart version 3.6.1
• DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/dipeshjethwa/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/dipeshjethwa/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] Connected device (5 available)
• iPhone XR (mobile) • 00008020-0006111C2EBB002E • ios • iOS 18.1.1 22B91
• iPhone 16 Pro Max (mobile) • B54FE8C6-4409-4786-A839-B741E66304A6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.2 24C101 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.2 24C101 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.206

[✓] Network resources
• All expected network resources are available.

• No issues found!
Process finished with exit code 0

Plugin version

v6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@grove86dipesh grove86dipesh added the bug Something isn't working label Jan 22, 2025
@grove86dipesh
Copy link
Author

@pichillilorenzo did you check this thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant