WebView后退按钮注销用户

时间:2014-11-05 09:59:00

标签: android android-webview

采取的步骤:

  

1。用户打开应用(〜/ home / 这是登录页面)

     

2. 用户登录(现在网址为〜/ home / profile /

     

3. 用户点击链接(例如〜/ home / profile / photos /

     

4. 用户点击回来(现在网址是〜/ home / profile / ofc)

     

5. 用户再次点击回来(现在网址为〜/ home / 用户已退出

如何确保用户保持登录状态(从〜/ home /重定向到〜/ home / profile /,就好像我们正在登录一样。似乎没有涉及cookie。

public void onCreate( Bundle b ) {
    super.onCreate( b );
    ...

    this.webView.getSettings().setAppCacheEnabled( true );
    this.webView.getSettings().setSaveFormData( true );
    this.webView.getSettings().setDomStorageEnabled( true );
    this.webView.getSettings().setJavaScriptEnabled( true );
    this.webView.loadUrl( URL );
}

1 个答案:

答案 0 :(得分:0)

webView.clearHistory(); 当用户登录(到达 2 )并且用户试图进一步返回时,我会显示一个对话框,询问用户是否要退出应用。

相关问题