Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cookie Webview

Featured Replies

Posté(e)

Bonjour,

Suite à mes recherches, j'ai appris que l'on ne pouvait pas avoir accès aux cookies android depuis le navigateur mais seulement depuis une webview. J'ai donc chargé ma page web dans une webview pour pouvoir récupérer mes cookies.

Problème:

L'url que j'appelle me redirige vers deux autres urls qui servent l'identification de l'utilisateur l'url n°3 créé donc un cookie, que je souhaiterais récupérer. Je n'ai pas trop compris comment me servir de CookieSyncManager et CookieManager.

Le morceau de code que j'ai essayé me renvoi simplement le cookie de ma première url mais pas tous les cookies créés par la requête.


webView = (WebView) findViewById(R.id.webview);
	webView.setWebViewClient(new WebViewClient(){    
		@Override 
       	public void onReceivedHttpAuthRequest (WebView view, HttpAuthHandler handler, String host,String realm){ 
			handler.proceed("user","password"); 
           }

		public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
			Toast.makeText(Configuration.this, description, Toast.LENGTH_SHORT).show();
		}
	});

	webView.getSettings().setJavaScriptEnabled(true); 
	webView.getSettings().setUserAgentString("chrome");
	webView.setHttpAuthUsernamePassword("www.xxxx.fr", "", "user", "password");

	CookieSyncManager.createInstance(this);
	CookieSyncManager.getInstance().startSync();

	webView.loadUrl("http://www.xxxx.fr/xxxxxx.php");

	CookieSyncManager.getInstance().stopSync();

	CookieManager cManage = CookieManager.getInstance();
	System.out.println(cManage.getCookie(""));

Merci d'avance,

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.