5 years ago (2015-03-29)  computer technology |   First to comment  12 
post score 0 times, average 0.0

Today, the author opened the school's “Little Gourd Worker Assistant” to check the page about running and running, and was very interested in its web page source code.The designers of helpless web pages only allow users to open web pages in WeChat's own browsers. Mobile WeChat comes with browsers that do not have censorship elements and view source code.My first feeling is that the person who writes the code must be a mechanism that uses UA matching to limit access by other terminals.Therefore, the solution is very simple, in the computer simulation of a WeChat browser, the implementation method is to modify the browser's UA (userAgent). The test results went well: Get the link to the current page via the "Copy link" menu in the upper right corner of WeChat: http://npuxiaogua.mgschool.cn/wx/apps/paocao

When opening on a computer browser:

Simulate UA to implement web pages that can only be opened on WeChat

By modifying the browser UA results:

Simulate UA to implement web pages that can only be opened on WeChat

The following talk about the operation method:

 

I. "Google Chrome" review element

Right click - "Examine element" Click on the button of the review element cell icon (the left side of the element tab), enter the view of the analog cell phone, tablet computer, and other terminals. The following explanation is made on the screenshot: Now only in the UA above Fill in WeChat UA on the line.What is WeChat's UA?

Second, how to get visitors' UA information

In fact, the UA of the access device is very simple. The UA information of the access device is displayed in the website log of any website:

Here is a standard website log:

 

  • Where "61.*.43.34" is the visitor's IP,
  • [25/Mar/2015:23:38:15 +0800] - Date of visit
  • http://wangbaiyuan.cn/javascript-implementation-article-copy-plus-copyright-information.html—Access URL

Behind the URL is the UA information:

Mozilla/5.0 (Linux; U; Android 4.4.2; en-US; Lenovo A808t Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/10.2.1.550 U3/0.8.0 Mobile Safari/534.30 The above method, the author obtained the UA field of WeChat's own browser is as follows: Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12A365 MicroMessenger/5.4. 1 NetType/WIFI

Third, fill in UA in the Google browser terminal simulation interface

Mozilla/5.0 (iPhone; iPhone iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12A365 MicroMessenger/5.4.1 NetType/WIFI Refreshing the WeChat webpage you want to visit will never happen again. "This page can only be opened in WeChat's own browser" appears.

Fourth, expand and summarize:

1. You can use the above methods to simulate iPhone, iPad, and Android phones, so that when a web page is developed, you can use a computer to know the interface status of your web pages on different device terminals. 2. WeChat UA is: Mozilla/5.0 (iPhone CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12A365 MicroMessenger/5.4.1 NetType/WIFI

 

This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/analog-ua-implementation-access-to-open-only-on-the-app-page-2.html

Post comment

Style

No Comment

登录

Forget password?

您也可以使用第三方帐号快捷登录

切换登录

注册

TW