JQuery to refresh browser when Browser is resized

I found the following function that will refresh my browser when the browser is resized.  Is this the best way to do it or is there a better code that works cross browser?

/refresh page on browser resize
$(window).bind('resize', function(e)
{
  if (window.RT) clearTimeout(window.RT);
  window.RT = setTimeout(function()
  {
    this.location.reload(false); /* false to get page from cache */
  }, 200);
});

Open in new window

LVL 7
rgranlundAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Whats the point of the reload?
0
Randy PooleCommented:
That would be a good way of doing it, but I'm with Gary, why would you want to do this?
0
contactkarthiCommented:
$(window).resize(function () { location.reload();});
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

rgranlundAuthor Commented:
On the pages of my site, I'm using Cufon.js Font replacement.  When I size down my screen for a responsive design the page needs to reload for the new CSS at specific break points.  There are different font sizes at different browser sizes.  Without the page refreshing the design does not "Snap" into the new css parameters.

Is there a better way to do this?

In addition to this question, If I have a form on a page, is there a way to keep the form from re-submitting if the page refreshes?
0
GaryCommented:
So your window resize binding should be refreshing the cufon not the browser.

$(window).bind('resize', function(e)
{
  if (window.RT) clearTimeout(window.RT);
  window.RT = setTimeout(function()
  {
    Cufon.refresh();
  }, 200);
});

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgranlundAuthor Commented:
Oh, that is great, that is exactly what I needed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.