JS实现PC端URL跳转到对应移动端URL】的更多相关文章

在做移动端网站时,有时因技术问题或其他原因无法制作响应式版面,而移动端页面只能放到子目录下,但是手机端通过搜索引擎进入网站电脑端子页面,无法匹配到移动端页面,使得用户体验很不好,即影响排名也影响转化.这里有一个js代码可以实现用户使用手机访问电脑端,自动跳转到对应手机页面.举例:一个pc页面https://www.800xiaos.com/2/2795/,对应移动url为https://m.800xiaos.com/2/2795/,使用手机端访问pc页面https://www.800xiaos.…
打开drupal的.htaccess文件 找到 If your site can be accessed both with and without the 'www.' prefix 将下面对应的三行代码去掉注释,即去掉每行开头的#” 结果:…
URL跳转原理: 由于越来越多的需要和其他第三方应用交互,以及在自身应用内部根据不同的逻辑将用户引向到不同的页面,譬如一个典型的登录接口就经常需要在认证成功之后将用户引导到登录之前的页面,整个过程中如果实现不好就可能导致一些安全问题,特定条件下可能引起严重的安全漏洞. 攻击方式及危害: 恶意用户完全可以借用URL跳转漏洞来欺骗安全意识低的用户,从而导致”中奖”之类的欺诈,这对于一些有在线业务的企业如淘宝等,危害较大,同时借助URL跳转,也可以突破常见的基于“白名单方式”的一些安全限制,如传统IM…
一.PC端跳转到移动端 html页面: <script>var webroot="/",catid="{$catid}",murl="m/{$catdir}.html";</script> <script src="{JS_PATH}ql/mobile.js"></script> mobile.js文件: if((navigator.userAgent.toLowerCase()…
<script> (function () { var navUA = navigator.userAgent; var defIncludeStr = "iPhone|Android|iPod|BlackBerry|"; var defExcludeStr = ""; var redirectUrl = ""; var metas = document.getElementsByTagName("meta");…
CODE <script> //判断终端url跳转 function sp_isMobile() { return Boolean(navigator.userAgent.match(/.*(iphone|ipod|android|symbian|nokia|blackberry| rim |opera mini|opera mobi|windows ce|windows phone|up\.browser|netfront|palm-|palm os|pre\/|palmsource|ava…
之前写pc端直接跳转wap端一直是后端java写的,跟js一样都是根据navigator.userAgent来判断设备是电脑还是手机的,我知道这种前端也可已完成的功能,只是后台比较强势,本人本着以和为贵的精神就没有跟他争执. 不过我还是比较喜欢前端判断设备的,不需要经过服务器编译,减少服务器压力(个人认为,可能有错,非喜勿喷).下面我就写一段用js判断设备的代码,其中有些资料是查网上的. //设备检测 function detectmob() { if( navigator.userAgent.…
假设PC端域名为 www.abc.com     移动端域名为m.abc.com PC端nginx配置文件server中加入如下代码: if ($http_host !~ "^www.abc.com$") { rewrite ^(.*) http://www.abc.com$1 permanent; } if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) { rewrite…
判断pc端或移动端并跳转 代码目录: index.html代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> function IsPC() { var userAgentInfo = na…
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title></head><body>    <scrip…