Ecshop displays the wap mode on the web page of the tablet

Source: Internet
Author: User
Tags lenovo


Today, I accidentally used a Samsung 5.5-inch mobile phone to watch the ecshop Mall. Oh, it's so ugly. I used a simulated tablet to access it. What's worse, I used the mobile phone version of ecshop, but there is no suitable tablet size, so if you look at it on the tablet, it is best to use the web version of the computer, under the ecshop root directory index. in the php file, a jump is made to determine whether the mobile phone version is accessed, but the process is not very good, so it is necessary to delete it. If you want to watch the mobile phone, we can install a QR code scan, you can also directly create a hyperlink. The following summer blog will teach you how to delete this code that is not well judged.

Open the index. php file in the root directory and find the following code:

$ Ua = strtolower ($ _ SERVER ['http _ USER_AGENT ']); $ uachar = "/(nokia | sony | ericsson | mot | samsung | sgh | lg | philips | panasonic | alcatel | lenovo | cldc | midp | mobile)/I "; if ($ ua = ''| preg_match ($ uachar, $ ua ))&&! Strpos (strtolower ($ _ SERVER ['request _ URI ']), 'wap') {$ Loaction = 'mobile/'; if (! Emptyempty ($ Loaction) {ecs_header ("Location: $ Loaction \ n"); exit ;}}

If you do not know about php, you can add a js code in the header of the htm page, as shown below:

// Determine whether it is a mobile running environment
  

If (/AppleWebKit. * Mobile/I. test (navigator. userAgent) | (/MIDP | SymbianOS | NOKIA | SAMSUNG | LG | NEC | TCL | Alcatel | BIRD | DBTEL | Dopod | PHILIPS | HAIER | LENOVO | MOT-| Nokia | SonyEricsson | SIE -| Amoi | ZTE /. test (navigator. userAgent) {if (window. location. href. indexOf ("? Mobile ") & lt; 0) {try {if (/Android | webOS | iPhone | iPod | BlackBerry/I. test (navigator. userAgent) {// Determine whether the access environment is Android | webOS | iPhone | iPod | BlackBerry loads the following style setActiveStyleSheet ("style_mobile_a.css");} else if (/iPad/I. test (navigator. userAgent) {// Determine whether the access environment is iPad. Load the following style setActiveStyleSheet ("style_mobile_iPad.css ");} else {// Determine if the access environment is another mobile device, load the following style setActiveStyleSheet ("style_mobile_other.css");} catch (e) {}}} else {// if none of the above are available, load the following style setActiveStyleSheet ("style_mobile_no.css");} // load the style function setActiveStyleSheet (filename) {document. write ("<link href =" + filename + "rel = stylesheet> ");}


As shown in the preceding figure, different css devices can be used to create websites that are fully compatible with device browsers.

Delete it or comment it out. This time, if you use a tablet to open it again, it will be a web page on your computer. There will be no wap-mode web pages or any wrong code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.