Alex Kehayias's Blog

  • Archive
  • RSS

Javascript page reload with cross browser compatibility

This one stumped me for awhile because everyone seems to have their preferred method of doing page reloads using only javascript. After trying several, I was having compatibility issues with firefox 3.5 on windows. Javascript is pain in the ass sometimes (most of the time) when you have to worry about all the major browsers.

Here’s the best solution I could find and, after testing, it appears to work on all major browsers. I didn’t write it, but I found it buried in StackOverflow

This is what I originally tried, but it doesn’t work on FireFox 3.5:

document.location.reload(true);

This works on all major browsers including FireFox 3.5

window.location.href = location.href + "?" + Date.parse(new Date());

Source: stackoverflow.com

  • 6 months ago
  • 1
  • Permalink
  • Share
    Tweet

1 Notes/ Hide

  1. r4vi reblogged this from alexkehayias and added:
    should be pretty cross browser too. Even really old crappy ones. var meta; if (document.createElement && (meta
  2. alexkehayias posted this
← Previous • Next →

About

Blogging about hacking code, life, and music.

Me, Elsewhere

  • @alexkehayias on Twitter
  • Facebook Profile
  • Linkedin Profile

Twitter

loading tweets…

I Dig These Posts

  • Photo via marksbirch

    Every so often in my web ramblings, I come across an interesting tidbit. While not meant to be an endorsement of Automattic, I find it interesting...

    Photo via marksbirch
  • Post via franciscohui
    Some thoughts on pacing your life

    We live with contradictions. Which are okay for the most part, except when we’re not aware of them. It is a source...

    Post via franciscohui
  • Photoset via lifeandcode

    hasablog:

    GitHub stickers! Awesome gift :]

    Photoset via lifeandcode
  • Photo via franciscohui

    skewed. (via Porca Miseria)

    Photo via franciscohui
See more →
  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr