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>
[edited by: phranque at 8:43 pm (utc) on Jan 21, 2014]
[edit reason] disabled graphic smileys [/edit]
<script type="text/javascript">
<!--
if (screen.width <= 699) {
var mobilec = GetCookie('mobileredirect');
if (mobilec!='mobi') {
window.location = ("http://m.sample.com");
}
}
</script>
<script type="text/javascript">
if (screen.width <= 699) {
alert("screen.width is " + screen.width);
var mobilec = GetCookie('mobileredirect');
alert("mobilec = " + mobilec);
alert("mobilec!='mobi'? " + (mobilec!='mobi'));
if (mobilec!='mobi') {
alert('Redirecting...');
window.location = ("http://m.sample.com");
}
}
</script>
function set_mobile_cookie() {
if (!isset($_COOKIE['mycookie']))
{ setcookie("mycookie", myvalue, time()+3600, "/", ".url.com");
}}
add_action( 'init', 'set_mobile_cookie'); <script language="JavaScript" type="text/javascript">
function checkCookie()
{
var mobilename=getCookie(mycookie);
if (mobilename!="myvalue")
{
if (screen.width <= 699) {
window.location = "http://m.url.com";
} } }
window.onload = checkCookie;
</script> How would I define it? I thought it was the following?
var mobilename=getCookie(mycookie);
var mobilec = GetCookie('mobileredirect');
alert("mobilec = " + mobilec);
<script language="JavaScript" type="text/javascript">
function checkCookie()
{
var mobilename=getCookie(mycookie);
if (mobilename!="myvalue")
{
if (screen.width <= 699) {
window.location = "http://m.url.com";
} } }
window.onload = checkCookie;
</script>
<script language="JavaScript" type="text/javascript">
var mobilename=ReadCookie(mycookie);
if(mobilename.length == 0) {mobilename='newvisitor'; }
function checkCookie()
{
if ((mobilename!='myvalue') && (screen.width <= 699))
{window.location = "http://m.url.com"; }
}
alert("mobilename = " + mobilename);
window.onload = checkCookie;
</script>
I get no alert….
I get no alert….
var mobilename=ReadCookie(mycookie);