Recently in the development, but has been ignoring a problem how to restrict the page to open only in?
In PHP scripts, you can determine whether the browser is a built-in browser by judging Http_user_agent
But today, watching the pudding move under the micro-car public platform Many page restrictions can only be opened in the method should not be judged by the script in the browser's header information, now ask the micro-car limit page only open in the browser idea is what?
Reply content:
Recently in the development, but has been ignoring a problem how to restrict the page to open only in?
In PHP scripts, you can determine whether the browser is a built-in browser by judging Http_user_agent
But today, watching the pudding move under the micro-car public platform Many page restrictions can only be opened in the method should not be judged by the script in the browser's header information, now ask the micro-car limit page only open in the browser idea is what?
There will be micromessenger in the open navigator.useragent.
OAuth2.0 Authorization for the micro-car call
There are many built-in JS built-in APIs that can be used to determine if these APIs exist.
Http://www.baidufe.com/item/f07a3be0b23b4c9606bb.html
I am now doing the project, is the public number, users click on our site, will go to the server to obtain user OpenID, if not obtained, it is not open browser. So that users can enter the system only when the browser is opened
It's basically all answered.
1, JS or program judgment, useragent, whether it contains Micromessenger
2. js to judge the relevant specific functions
3, call the OAuth interface, if you do not want user-aware, you can call the Scope=snsapi_base way, this finally can only get user OpenID. Scope=snsapi_userinfo mode, the user will see an authorization page, click on the authorization, you can get all the user information.
The front end is best not to use UA to determine whether it is a built-in browser, because it is too easy to forge.
So to judge
if( typeof WeixinJSBridge !== "undefined" ) { return true;}
Web page with open must have to do oauth page authorization?