A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: MEDIA QUERIES to Load specific HTML file

Hybrid View

  1. #1
    Member
    Join Date
    Apr 2007
    Location
    Manhattan, New York, USA
    Posts
    58

    MEDIA QUERIES to Load specific HTML file

    Hello. I'm looking for a short media query/JavaScript script that will tell the browser to load a specific html file depending on the device or the browser width. Any tutorials anyone can point me to? Thank you in advance.

    FS

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Generally speaking it's a good practice to use CSS and media queries to reformat a single page to display differently on different devices.

    Detecting screen size isn't particular difficult, though.

    Code:
    var screenSize=document.documentElement.clientWidth;
    if(screenSize<someNumber){
      window.location="somepage.html"
    }

  3. #3
    Member
    Join Date
    Apr 2007
    Location
    Manhattan, New York, USA
    Posts
    58
    Thanks for that. I'll try that later. I'm also going to try the jQuery Ready function...I
    ll post the code if it works properly.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center