1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Redirecting to mobile ?

Discussion in 'HTML & Website Design' started by lightCode, Jun 14, 2017.

  1. #1
    I am wanting to redirect to mobile version of website via javascript, based on screen size. I know how to implement this, however, im concerned that if i put this script in index.html, it will run every time the page is loaded, thus not allowing mobile users to access the desktop version because the script with recognize the screen size as mobile every time index (script) is loaded.

    Am i correct about this assumption? Work arounds, etc? Thanks
     
    lightCode, Jun 14, 2017 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,499
    Likes Received:
    377
    Best Answers:
    29
    Trophy Points:
    335
    #2
    There are zero compelling reasons to do that. Several years ago, maybe. Even then a sane web page would adjust itself for a smaller screen automagically. It's what HTML does; it's called 'flow'.

    See the many posts from @deathshadow and read carefully his on progressive enhancement.

    gary
     
    kk5st, Jun 14, 2017 IP
  3. Rokis

    Rokis Member

    Messages:
    60
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    45
    #3
    I might need to see a website before giving the right answer to you, but I believe making a responsive website is what you want to do instead of redirecting people elsewhere regarding to the screen size.
     
    Rokis, Jun 14, 2017 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,688
    Likes Received:
    1,988
    Best Answers:
    251
    Trophy Points:
    515
    #4
    That you even have the notion in your head of a SEPARATE site for mobile, much less that scripttardery is the way to handle it? SOMEONE has been packing you so full of Manure that Biff Tannen could drive Marty's mom to the prom in you.

    Responsive layout exists for a reason. Semantic markup exists for a reason. Separation of presentation from content exists for a reason.... USE THEM!!!

    Particularly when your scripted width rubbish would be a giant middle finger at accessibility since JS sucks at pulling EM's preferring to work in px.
     
    deathshadow, Jun 14, 2017 IP
  5. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #5
    div align= 100%
     
    locals, Jul 24, 2017 IP