Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Invariably, you're going to have to use some JavaScript. What you want is for your refresh code to run when the page is completely loaded. You could use the HTML <code>onload</code> event, but there are problems with this (e.g. it will fire before any images are loaded). I would suggest using JQuery's <a href="http://api.jquery.com/ready/" rel="nofollow"><code>ready()</code> event</a>, if you want to be sure it fires after the entire page is loaded.</p> <p><strong>Example:</strong></p> <pre><code>// NOTE: This will only work with JQuery loaded. $(document).ready(function(){ location.reload(true); }); </code></pre> <p>Making this only fire on the first page load is a bit more tricky. You could add an anchor suffix to the URL to keep track of whether you've refreshed the page yet or not, and then only refresh if it is not present in the URL:</p> <pre><code>$(document).ready(function(){ if(location.hash != "#") { // Set the URL to whatever it was plus "#". // (The page will NOT automatically reload.) location = "#"; // Reload the page. location.reload(true); } }); </code></pre> <p>Alternatively, you could use the query string, since this will automatically refresh the page when changed:</p> <pre><code>$(document).ready(function(){ var marker = 'r'; // 'r' is for "refreshed" if(location.search != "?"+marker) { // Set the URL to whatever it was plus "?r". // (This will automatically force a page reload.) location = "?"+marker; } }); </code></pre> <p><strong>Caveat:</strong> With either of these samples, if your user bookmarks the page after the "#" or "?r" tag has been added to the URL, the page won't refresh when they revisit the page. If you want it to be bulletproof, you might have to use a cookie instead.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload