Redirect 如何在移动版本中重定向html页面而不刷新重定向页面

Redirect 如何在移动版本中重定向html页面而不刷新重定向页面,redirect,Redirect,如何仅在移动版本中重定向html页面url而不刷新页面 $(document).ready(function() { if (screen.width <= 800) { document.location ="page.html"; } }); 例子 例1 标题 Lorem ipsum dolor sit amet,是一位杰出的献身者。Aliquam nec dui commodo,imperdiet mauris ac,molestie massa。在马萨

如何仅在移动版本中重定向html页面url而不刷新页面

 $(document).ready(function() {
  if (screen.width <= 800) {
  document.location ="page.html";
  }

   });

例子

例1

标题 Lorem ipsum dolor sit amet,是一位杰出的献身者。Aliquam nec dui commodo,imperdiet mauris ac,molestie massa。在马萨,我是狮子座的狮子座的狮子座

例2

标题 Lorem ipsum dolor sit amet,是一位杰出的献身者。Aliquam nec dui commodo,imperdiet mauris ac,molestie massa。在马萨,我是狮子座的狮子座的狮子座

该页面布局如何在不使用javascript刷新页面的情况下仅显示移动版本


仅移动版将显示此页面,无需刷新

您可以使用以下编码语言之一(JS、.htaccess、PHP):

JS:

if (screen.width <= 699) {
    document.location = "mobile.html";
}
RewriteEngine On

# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)noredirect=true(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]

# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
#  had to check, but I believe most mobile devices should send at
#  least one of these headers)
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile}       !^$
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie}        !\smredir=0(;|$)
# Now redirect to the mobile site
RewriteRule ^ http://m.example.org%{REQUEST_URI} [R,L]
<? if (
stristr($ua, "Windows CE") or
stristr($ua, "Mobile") ) {
$DEVICE_TYPE="MOBILE";
}
if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") {
$location='YOUR-MOBILE-SITE.com/index.php';
header ('Location: '.$location);
exit;
}
?> 
资料来源: