Shistastic
Shistastic

Reputation: 319

Flutter webview set cookies as URL parameters

I would like to know if it's possible to set a cookie in a webview to pass a query parameter to a webview URL in the following way. My URL would be mydomain.com?isMobile=true And would like to set the parameter isMobile=true as a fixed cookie to include And force the parameter.

The reason I need to do It with cookies is because I was told it's the correct way to do It, asswell because forcing the parameter directly into the URL is making some functions in my webview to not work as It would on a browser.

I'd appreciate any feedback even without using cookies about how to work webview to make some realtime web functions update as It would on a browser.

This issue is driving me absolutely crazy, thank you very much un advance.

Upvotes: 0

Views: 1414

Answers (1)

Shistastic
Shistastic

Reputation: 319

In the end They're were problems related to a firewall on the webpage that made the cookies not work as intended in the end the solution was as simple as declarion the initialCookies as follows in the WebView Widget.

WebView(
 initialCookies: [
      WebViewCookie(
         name: cookieName,
         value: cookieVal,
         domain: cookieDomain,
         path: cookiePath,
     ),
   ],
),

Upvotes: 1

Related Questions