Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome clears CSS styles for current page when opening link in new tab or opening a new window

This is odd one, I was troubleshooting for 3 days.

Only happening in Chrome Version 53.0.2785.116 m (64-bit) on Windows.

Web server must have header set (meta tag doesn't work in this case):

Apache's .htaccess: Header set Cache-Control "no-cache" or nginx: add_header Cache-Control no-cache;

You can't recreate it using jsfiddle or built-in code snippet, because css file must be loaded separately using <link href='style.css' rel='stylesheet' type='text/css'>. (but I will include code in snippet anyways).

Steps to recreate:

  1. Visit: http://test.xmpsoft.net/
  2. Click on link 1 (should reload the page);
  3. Click on link 2 (should bring up new tab with the same page);
  4. Switch to the original tab and repeat same steps;
  5. All CSS styles are gone from the original tab.
  6. If not, repeat same steps again.

Please assist to make sure where is nothing wrong with the code before I submit it to Google.

Thanks.

P.S. There is another way or recreating it (that's why I mentioned 'new window' in my Title: Visit same page, reload it, right click -> Inspect (new Development Tools window opens), switch back to the page (repeat if not able to recreate).

.menu div {
	display: inline-block;
	width: 15em;
	height: 15em;
}

.red {
	background-color: red;
}

.yellow {
	background-color: yellow;
}

.green {
	background-color: green;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Chrome bug</title>
<link href='style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class='menu'>
  <div class='red'>Red</div>
  <div class='yellow'>Yellow</div>
  <div class='green'>Green</div>
</div>
<a href='/'>1. Reload this page</a><br>
<a href='/' target='_blank'>2. Open same page in new tab</a>
</body>
</html>
like image 258
Alex G Avatar asked Sep 19 '16 04:09

Alex G


1 Answers

This issue was fixed by Google developers and will be merged to the stable channel soon already merged into Version 53.0.2785.143 m (64-bit).

https://bugs.chromium.org/p/chromium/issues/detail?id=648237#c6

like image 106
Alex G Avatar answered Oct 11 '22 14:10

Alex G