Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS is it possible to program a media query to send you to another web page?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45034
    drotar
    Participant

    i have an overall phone landscape and portrait layout. on the other pages of my website when the user views them on their mobil device I would like to have them forwarded to the overall phone website. is this possible or am i just dreaming?

    d

    #136396
    Alen
    Participant

    Not possible with Media Query. You would need some JavaScript to test the width of the viewport. However, if you are interested in redirecting users you should really do some user agent sniffing instead, rather than relying on the viewport to tell you what the user is using.

    #136398
    JillesMe
    Member

    This is indeed not possible with Media Queries, but you could use JavaScript (jQuery), it would look something like:

    $(window).on(‘resize load’, function(){
    var width = $(window).width();
    if(width <= 600){ // Where 600 is the width
    window.location = ‘http://www.google.com&#8217;;
    }
    });

    #136399
    drotar
    Participant

    thank you, i’ll definitely give it a test.

    d

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.