0

I would expand to make my question more clearly:

i have a flutter app and a website. inside the flutter app i have a webview of the website. i want that in the webview the ui and functionality will be a little different than the actual website. for example, if there is a button in the website that is red, i want it to be blue on the flutter app. is there a way through in_app_webview to send a function to the website's javascript that return a boolean if the website was opened via flutter or not, and change the website's code accordingly. is what im asking to do possible? and how do i do that?

thanks in advance :)

1 Answer 1

2

I think it possible by send custom header to web

InAppWebView(
        initialUrlRequest: URLRequest(
          url: Uri.parse("https://example.com"),
          headers: {
            "from_flutter": "true",
          },
        ),
 ),

or Do it manually by inject javascript to in_app_webview to change color or whatever you want https://inappwebview.dev/docs/5.x.x/webview/javascript/injection/

Sign up to request clarification or add additional context in comments.

2 Comments

and sorry for the noob follow up question. how do i get this header in the client website?
@YuvalPoliak It depend on you web language like react was use app.get('/example-path' , (request , response) => header = request.header) something like this

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.