You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by sinofool <gi...@git.apache.org> on 2015/02/26 22:37:13 UTC

[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

GitHub user sinofool opened a pull request:

    https://github.com/apache/cordova-android/pull/162

    CB-3360 Set custom User-Agent

    Add two configurations to set user agent of webview.
    OverrideUserAgent to override UA to the setting value.
    AppendUserAgent to append the setting value to default UA

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sinofool/cordova-android master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-android/pull/162.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #162
    
----
commit 4f9f7bb2ad0a4be8633a5b2b2f23f608c3697bfa
Author: Bochun Bai <bb...@sinofool.net>
Date:   2015-02-24T00:00:22Z

    CB-3360 Set custom User-Agent

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by sinofool <gi...@git.apache.org>.
Github user sinofool commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/162#discussion_r27695146
  
    --- Diff: framework/src/org/apache/cordova/engine/SystemWebViewEngine.java ---
    @@ -199,7 +199,19 @@ private void initWebViewSettings() {
             
             // Fix for CB-1405
             // Google issue 4641
    -        settings.getUserAgentString();
    +        String defaultUserAgent = settings.getUserAgentString();
    +
    +        // Fix for CB-3360
    +        String overrideUserAgent = getCordovaWebView().getPreferences().getString("OverrideUserAgent", null);
    --- End diff --
    
    @agrieve Yes, thanks for the great suggestion, I will change it this weekend.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by staugaard <gi...@git.apache.org>.
Github user staugaard commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-97878035
  
    Yeah I also need this. :+1: 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on a diff in the pull request:

    https://github.com/apache/cordova-android/pull/162#discussion_r27606969
  
    --- Diff: framework/src/org/apache/cordova/engine/SystemWebViewEngine.java ---
    @@ -199,7 +199,19 @@ private void initWebViewSettings() {
             
             // Fix for CB-1405
             // Google issue 4641
    -        settings.getUserAgentString();
    +        String defaultUserAgent = settings.getUserAgentString();
    +
    +        // Fix for CB-3360
    +        String overrideUserAgent = getCordovaWebView().getPreferences().getString("OverrideUserAgent", null);
    --- End diff --
    
    I'd like to avoid circular dependency if possible on CordovaWebView.
    
    Rather than depending on CordovaWebView here, could you save the instance of CordovaPreferences passed to the constructor and use that instead? Would also need to add CordovaPreferences as a 2nd arg to the other constructor as well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by sinofool <gi...@git.apache.org>.
Github user sinofool commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-99629530
  
    I will update the docs later. For both iOS and Android.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-99489261
  
    (and thanks!)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by sinofool <gi...@git.apache.org>.
Github user sinofool commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-92611688
  
    The Travis CL build failed due to new android-21 setup.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by delijati <gi...@git.apache.org>.
Github user delijati commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-99019365
  
    Need this feature too. The old way in `onCreate` is not working anymore.
    
    ```
    super.appView.getSettings().setUserAgentString("Your own agent string");
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android issue #162: CB-3360 Set custom User-Agent

Posted by kleeb <gi...@git.apache.org>.
Github user kleeb commented on the issue:

    https://github.com/apache/cordova-android/pull/162
  
    I guess that JS bridge is missing?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by agrieve <gi...@git.apache.org>.
Github user agrieve commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-99489147
  
    Merged. would be great if you could do another PR to update the docs:
    https://github.com/apache/cordova-docs/blob/master/docs/en/edge/guide/platforms/android/config.md


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by shazron <gi...@git.apache.org>.
Github user shazron commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-99633548
  
    @sinofool There is already an issue for the iOS Doc CB-8960


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android issue #162: CB-3360 Set custom User-Agent

Posted by roysG <gi...@git.apache.org>.
Github user roysG commented on the issue:

    https://github.com/apache/cordova-android/pull/162
  
    How should we use it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by delijati <gi...@git.apache.org>.
Github user delijati commented on the pull request:

    https://github.com/apache/cordova-android/pull/162#issuecomment-106200325
  
    This solution is not sufficient for my needs i need to set the User-Agent from JS. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-android pull request: CB-3360 Set custom User-Agent

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-android/pull/162


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org