0

I have problem without solution and need help.

I take secure code to prevent http refresh, it monitoring if the client request too mutch http response and prevent it to take the server down.

If we take too mutch refresh on page, the client gets blank page with the tittle "Loading..." for 2 seconds, and after that the normal page load.

To make that the code use:" meta http-equiv="Refresh" " tag, and by some reason on determined situation the page still refreshing without stop.

I searched for some solution, and found that was a "inssue" from Chrome and apparently with no solution.

I try use javascript to verify if client using Chrome, and if is Chrome don't refresh with meta tag, make the refresh with javascript.

Anyway, Chrome still exhibits this behavior, which is making me nuts.

If you want to try, can you access www.sport4u.com.br access any product or link on page, press F5 many times (10seconds) when you get blank screen with Loading title press "History back" button, and wait.

What can be causing this, and how can I solve it?

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Guerra
  • 2,792
  • 1
  • 22
  • 32
  • If people refreshing a page can take the server down, then you might want to investigate the _exactly_ cause of the problem and perhaps look at implementing some caching on the server. I tried refreshing your site many times but the page always loaded for me with no problems. – andyb Nov 09 '12 at 11:53
  • @andyb, dont really take the server down, but slow down substantially. You must click on product, refresh many times and back the page when is on "LOading" page, and must using Chrome too. – Guerra Nov 09 '12 at 11:56
  • OK, wow, I can see the refreshing problem now! – andyb Nov 09 '12 at 12:04
  • see, @andyb its a big problem. – Guerra Nov 09 '12 at 12:18
  • @Guerra No, I honestly can't understand what you mean with "Better the be **", and it takes me far longer than it should to figure out what you're asking in your question than it would if you used proper English. –  Nov 09 '12 at 12:32

2 Answers2

3

OK this is very strange as it seems to be caused by Chrome's auto-translate feature. I am using Chrome 24.0.1312.5 dev-m running on English Windows 7 and when I load http://www.sport4u.com.br/ then the page automatically reloads every 2 seconds. In fact, if I view the page source I get the following:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />

<meta http-equiv="Content-Language" content="tr">
<script>
    window.setTimeout('window.location.reload(); ',2000);
</script>
<title>Loading...</title>
</head>


<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#fff">

and immediately you can see the reload() code.

Chrome has also popped open the auto-translate bar at the top of the page as it thinks the page is in Portuguese and offers to translate it. However on the second reload (after 2 seconds) Chrome now thinks the page is in Turkish (as this is the language in the code above)! This continues many times until eventually Chrome stops. Even closing the translate bar at the top does not stop the reloading.

If I disable the Chrome translate settings (chrome://settings/search#languages) and load the page, there is no refreshing and the View Source returns the correct page.

I would suggest either instructing Chrome to not refresh the page - see Why does Chrome incorrectly determine page is in a different language and offer to translate? or fix the encoding problems with certain characters which is making Chrome think the page is in the wrong language. If you run the page through the W3C validator it shows an incorrectly encoded character which might be the cause.

Community
  • 1
  • 1
andyb
  • 43,435
  • 12
  • 121
  • 150
  • Ty for the help. I'll try it andyb, yes the page is on Portuguese, but i think isn't a translation problem becouse i have Portuguese as native language on Windows and Chrome, and o got the refresh too. If you access with any other browser you can see the expect behavior of this page, its just block mutch refresh and reload the normal page after 2 seconds of "block" its simple. – Guerra Nov 09 '12 at 12:31
  • Does Chrome think the page is in Turkish for you? Also, is the code above in my answer generated from your site? – andyb Nov 09 '12 at 12:37
  • I don't think so, becouse it dont say nothing about it. But its something. I'll remove that tag to see what happens. – Guerra Nov 09 '12 at 12:39
  • andyb, I removed the meta tag for TR and don't solve. :[ see if Chrome ask for translate pls. – Guerra Nov 09 '12 at 12:46
  • Yes, I now just get the auto-translate to Portuguese as expected. However the refresh is also fixed! – andyb Nov 09 '12 at 12:57
  • So where is the code in my answer coming from? That is definitely the cause of the reloading. I think you need to work out why that code is sent back from the server. I would also still try and fix the encoding problems I mentioned in my answer. – andyb Nov 09 '12 at 13:07
  • This code coming from the security code i've make to prevent too mutch refresh on server. But it must bring just when user is block, if you call history back and wait 2 seconds the user isn't block anymore. If you press f5 untill get "Loading" and just wait you 'll see the expect behavior. – Guerra Nov 09 '12 at 13:12
  • It could be a logical problem but just happens on Chrome, what make me think isn't. – Guerra Nov 09 '12 at 13:12
  • OK, if I press `F5` I see the refreshing again and sometimes it happens when I just visit the page. I never see the `Loading...`, I only see a page reload every 2 seconds. I think your _security_ code is wrong. Reloading a page on a timeout in JavaScript is the wrong solution to the "too much refresh on server" problem. I suggest you look at implementing server side caching in PHP. – andyb Nov 09 '12 at 13:37
1

Have you tried any alternatives to "meta http-equiv='refresh'" ?

Have a look at using header(); before any content is loaded to redirect instead, as that meta tag is depreciated.

header("Location: index.php");
die();
Adam Tomat
  • 11,206
  • 6
  • 39
  • 47
  • Hi Adam, thankyou for the Answer, i've tryed all variation for meta http refresh. Ill try this header command, and post feedback here. – Guerra Nov 09 '12 at 11:51