Refresh a Browser's Page on Click of Body/Any Part of Page
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

The title says it all. I am looking for an example, in JSFiddle or similar, of a webpage being refreshed on-clicking anywhere in the page. I've tried applying .onclick with JavaScript to the body without luck.

Please let me know if I can provide more information that will lead to a solution!

Thank you.

awarded to jduplessis294

Crowdsource coding tasks.

3 Solutions

Im in phone, this is the basics, for the click listener, try the document click, might work better with simple js
Chlegou 3 months ago

Try this:

document.addEventListener('click', function(e){
    window.location.reload();
}, true);

Bye!

Winning solution

Heres a jsFiddle that should work more reliably across older browsers:

http://jsfiddle.net/1yfxb4h7/22/

Thanks, looks great!
sharper 3 months ago
Hey jduplessis, would you be interested in making this work for taps on a phone for a tip of the same amount? I thought it would register as such but I was wrong. Haha
sharper 3 months ago
View Timeline