Grow your CSS skills. Land your dream job.

mobile redirecting with jQuery. (location.href || location.replace)?

  • # June 4, 2012 at 4:26 am

    Howdy css-tricks forum folks.

    Can anyone inform me the advantages or personal preferences when using either window.location.href or window.location.replace?

    My Code:

    if($(window).width() < 600) // Lazy Mobile redirection
    {
    window.location.replace("m.contact.html");
    // window.location.href = "m.contact.html";
    }
    # June 6, 2012 at 3:33 am

    I think the only significant difference is that the window.location.replace() method will replace the most current history item opposed to creating a new one…nothing really to special

    # June 6, 2012 at 6:55 pm

    @kgscrott284, thanks. I did some research and at least for what im trying to accomplish its either (POE-tae-toe) or (POE-ta-tow)… im going to stick with replace. Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".