Forum Moderators: open
<script type="text/javascript">
<!--
if (screen.width <= 699) {
window.location = ("http://sample.com");
}
</script> <script type="text/javascript">
<!--
if (screen.width <= 699) {
var mobilec = GetCookie('mobileredirect');
if (mobilec!='mobi') {
window.location = ("http://m.sample.com");}
}
</script>
<script language="JavaScript" type="text/javascript">
function get_cookie ( cookie_name )
{
var cookie_string = document.cookie ;
if (cookie_string.length != 0) {
var cookie_value = cookie_string.match (
'(^|;)[\s]*' +
cookie_name +
'=([^;]*)' );
return decodeURIComponent ( cookie_value[2] ) ;
}
return '' ;
}
mobilename=get_cookie(mycookie);
if(mobilename.length == 0) {mobilename='newvisitor'; }
else
{
if ((mobilename!='myvalue') && (screen.width <= 699))
{window.location = "http://m.url.com"; } }
</script>
<script language="JavaScript" type="text/javascript">
function getCookie(c_name) {
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return ""
}
mycookie = "mycookie";
mobilename = "newvisitor";
mobilename=getCookie(mycookie);
if ((mobilename!='myvalue') && (screen.width <= 699))
{window.location = "http://m.url.com"; }
</script> <script language="JavaScript" type="text/javascript">
mycookie = "mycookie";
myvalue = "myvalue";
function set_mobile_cookie() {
if (!isset($_COOKIE['mycookie']))
{ setcookie("mycookie", myvalue, time()+3600, "/", ".url.com");
}}
add_action( 'init', 'set_mobile_cookie');
</script>
add_action( 'init', 'set_mobile_cookie');
setcookie("mycookie", myvalue, time()+3600, "/", ".url.com")
<script type="text/javascript">
function getCookie(c_name) {
var c_start, c_end;
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
}
var mycookie = "mycookie";
var mobilename = getCookie(mycookie);
if ((mobilename != 'myvalue') && (screen.width <= 699)) {
window.location = "http://m.url.com";
}
</script>
<script language="JavaScript" type="text/javascript">
mycookie = "mycookie";
myvalue = "myvalue";
function set_mobile_cookie() {
if (!isset($_COOKIE['mycookie'])) {
setcookie("mycookie", myvalue, time() + 3600, "/", ".url.com");
}
}
add_action('init', 'set_mobile_cookie');
</script>