parti
parti

Reputation: 215

Page Reload for Opera

I'm trying to get this page reload function to work in the new Opera v12. The function allows you to click away from a page & then come back and at that point the page is reloaded with a clean cache, ie fresh. What do I need to change to get it to work for Opera?

window.onload = function() {
  var rel = document.getElementById('forme').toBeReloaded.value; //get the current var value
  if (rel==1) {  // retrieved from the server (reloaded)
    if ($.browser.webkit || $.browser.msie) {
    window.location.reload(); //loaded from the cache
    }
    if ($.browser.mozilla) {
      buttonPlace();
      console.log('Firefox Reload: ');
    }
    if ($.browser.opera) {
      window.location.reload(true);
      console.log('Opera Reload: ');
    }
  }
  else {
    document.getElementById('forme').toBeReloaded.value = 1;
  }
}

Thanks, Bill

Upvotes: 1

Views: 1194

Answers (1)

parti
parti

Reputation: 215

Figured it out using document ready and:

$(function() {
    var rel = $('[name=toBeReloaded]');
    if(rel.val() == 1) {
      rel.val(0);
      if ($.browser.opera) {
        location.href = location.href;  // reload
      }  
      else {
        location.href = location.href;  // reload
      }      
    }
    else {
    rel.val(1);
    }
  });

Bill

Upvotes: 1

Related Questions