【问题标题】:How to customize google chrome tab hover cards如何自定义谷歌浏览器标签悬停卡
【发布时间】:2020-04-05 11:13:58
【问题描述】:

有什么办法可以自定义chrome 78+的tab悬停卡吗? 自定义是指更改悬停卡片的文本。

页面打开为空白,然后使用写入功能添加 html 文本。然后我改了标题。

var win = window.open();
win.document.write(htmlText);
win.document.title = htmlFileName

我的实际问题是,当我将鼠标悬停在标签上时,它会显示“Loading...”而不是实际的标题(htmlFileName 的值)。

“我知道要求用户将 chrome 标志 tab-hover-cards 设置为禁用不是一个好办法” 另外,解决方案应该支持ie9+

【问题讨论】:

  • 更新:window.stop();document.close(); 无效。
  • 您能找到解决方案吗?

标签: javascript html google-chrome-flags


【解决方案1】:

虽然这个问题已经超过 1 年了。我仍然想提出一个解决方案。请尝试以下方法:

var win = window.open("about:blank");
win.document.write(htmlText);
win.document.title = htmlFileName

window.open 中添加"about:blank" 将在选项卡悬停卡片上显示页面标题,而不是“正在加载...”

【讨论】:

    【解决方案2】:

    添加 win.document.close() 不会使标签保持在加载状态。

    var win = window.open();
    win.document.write("<html>Hi</html>");
    win.document.title = "Testing";
    win.document.close();
    

    上面的代码对我有用。

    【讨论】:

    • 很抱歉这么说。没用。标签悬停卡仍显示“正在加载...”。
    猜你喜欢
    • 2013-08-05
    • 2018-03-06
    • 2016-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-01
    • 2023-03-09
    • 2017-02-01
    相关资源
    最近更新 更多