How to distinguish between mobile app and browser?

自古美人都是妖i 提交于 2020-01-25 11:43:08

问题


My question may sound like "already asked", but I cannot find any answer. My problem is :

I have a phonegap app that only display a remote website (that website is responsive and work perfectly on mobile device). So the app is very simple :

function onBodyLoad() {
    document.addEventListener("deviceready", function(){
        location.href = "http://www.mydomain.com/";
    }, true);
}

As you can see this I just a redirection when that app starts. With that method I have no access to phonegap API after the redirection (am I right?).

My question(s) is: is that method the right method? How can I display/hide element on a webpage depending on the webpage is accessed by the app or by mobile browsers?

Thank you so much

Greg


回答1:


Just be aware that you are not allowed to do this from Apple.

From the App Store Review Guideline

2.12 Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected



来源:https://stackoverflow.com/questions/19537950/how-to-distinguish-between-mobile-app-and-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!