Results 1 to 3 of 3

Thread: Need simple script help

  1. #1
    Join Date
    Nov 2012

    Need simple script help

    I need what I hope is a very simple script - if a particular screen width is detected, ask the user if they want to go to the mobile site. If they say yes (Ok button), take them there, if they click Cancel, don't do anything.

    I haven't been able to find an example of this, or even similar code that I could tweak (I'm too noob).

    Can someone help me with this?

    We were previously redirecting people automatically but had a few reports of it malfunctioning, so I want to make it optional. This is what we had before:

    if (screen.width <= 1300) {

  2. #2
    Join Date
    Aug 2008
    window.location is not a function.
    if (screen.width <= 1300 && confirm('Redirect to mobile site?')) {
    	window.location = 'mobile.htm';

  3. #3
    Join Date
    Nov 2012
    Thank you! Before you responded, I managed to put something together, very close to what you have, and it's been working:
    if (screen.width <= 1300) {
    if(confirm("Would you like to go to our mobile site?")) document.location = 'mobile.htm';

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles