I have a userscript that refreshes the page every second, but sometimes the website it\'s trying to refresh runs into the status 503 error, and that stops the script from ru
The user-script run at page load, they won't run if page does not load at all for any status code other than 200. You can use as @Hemanth suggested but you have to break the infinite loop as the
will also load the user-script and so on. To break it just check if the user-script is loaded on the top window.
if (window == window.top) {
// Remove everything from the page
// Add an iframe with current page URL as it's source
// Add an event to reload the iframe few seconds after it is loaded
}
Complete Code:
(function ($) {
'use strict';
var interval = 5000;
if (window == window.top) {
var body = $('body').empty();
var myframe = $('