当在新标签页中打开链接或打开新窗口时,Chrome浏览器会清除当前网页的CSS样式 [英] Google Chrome clears CSS styles for current page when opening link in new tab or opening a new window

查看:142
本文介绍了当在新标签页中打开链接或打开新窗口时,Chrome浏览器会清除当前网页的CSS样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



只发生在 Chrome版本53.0.2785.116 m(64位元)



Web服务器必须包含标头集(元标记在此情况下不起作用):



Apache的.htaccess:标题集Cache-Controlno-cache
或nginx: add_header Cache - 控制非高速缓存;



您无法使用jsfiddle或内置代码片段重新创建它,因为css文件必须单独加载使用< link href ='style.css'rel ='stylesheet'type ='text / css'>



重新创建步骤:


  1. 访问: http://test.xmpsoft.net/

  2. 点击链接1 (应重新载入网页);

  3. 点击链接2(应显示相同网页的新标签页);

  4. 切换到原始标签并重复相同的步骤;

  5. 所有CSS样式都从原始标签中移除。

  6. 如果没有,请重复相同的步骤。

请在提交给Google之前协助确定该代码在哪里没有错误。



谢谢。



PS有另一种方式或重新创建它(这就是为什么我在我的标题中提到新窗口:访问同一页面,重新加载它,右键单击 - >检查(新开发工具窗口打开),切换回页面重新创建)。



  .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 ='text / html; charset = utf-8'>< title> Chrome错误 

解决方案

此问题已由Google开发人员修正,将很快合并到稳定频道中已合并到版本53.0.2785.143 m -bit)。



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


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>

解决方案

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

这篇关于当在新标签页中打开链接或打开新窗口时,Chrome浏览器会清除当前网页的CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆