treehouse : what would you like to learn today?
Web Design Web Development iOS Development

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

  • 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";
    }
  • 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
  • @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