javascript - 打开数据:text/plain window in chrome showing up blank

标签 javascript google-chrome window.open

当前功能正在运行,并且已经运行多年,但是在过去 3 周内,Chrome 上的用户突然无法访问纯文本文档,但在其他浏览器上仍然可以运行。

该函数基本上是这样运行的:

<a class="modo-link" target="_blank" data-modo="4%20Aether%20Hub%0A4%20Botanical%20Sanctum%0A1%20Blooming%20Marsh%0A3%20Forest%0A1%20Island%0A2%20Mountain%0A3%20Rootbound%20Crag%0A1%20Sheltered%20Thicket%0A2%20Spirebluff%20Canal%0A1%20Swamp%0A4%20Bristling%20Hydra%0A3%20Glorybringer%0A4%20Longtusk%20Cub%0A4%20Rogue%20Refiner%0A4%20Servant%20of%20the%20Conduit%0A2%20The%20Scarab%20God%0A4%20Whirler%20Virtuoso%0A2%20Abrade%0A4%20Attune%20with%20Aether%0A2%20Essence%20Scatter%0A4%20Harnessed%20Lightning%0A1%20Magma%20Spray%0A%0ASideboard%0A2%20Cartouche%20of%20Ambition%0A2%20Chandra's%20Defeat%0A1%20Confiscation%20Coup%0A3%20Negate%0A1%20Supreme%20Will%0A2%20Spell%20Pierce%0A1%20Hour%20of%20Glory%0A1%20Struggle%2FSurvive%0A2%20Vizier%20of%20Many%20Faces"><img src="https://227rsi2stdr53e3wto2skssd7xe-wpengine.netdna-ssl.com/wp-content/plugins/crystal-catalog-helper/assets/img/modologo.png"></a>

$('.modo-link').on('click', function() {
     var win = window.open('data:text/plain;charset=utf-8,' + $(this).attr('data-modo'), '_blank');
     win.focus();
});

示例在这里: https://www.channelfireball.com/articles/the-return-of-nationals/

只需找到“Temur Black”套牌列表并单击图像示例上方的图标:Deckilst icon

我似乎无法弄清楚是什么导致它在 Chrome 中打开一个空白窗口,而它以前工作正常,这可能是 SSL 的问题吗?

谢谢

最佳答案

Chromium 团队 intentionally deprecated and removed the ability to open data URLs 。此更改似乎从 Chrome 61 开始生效。

关于javascript - 打开数据:text/plain window in chrome showing up blank,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46818033/

相关文章:

javascript - 当用户选择不同的选项卡时,Chrome 中是否会触发事件?

Chrome 中的纯 CSS 粘性表格标题

javascript - `window.open` 函数不打开弹出窗口,但会消失现有的 html 和其他代码

范围减少的Javascript数组

Javascript:在同一行中声明一个变量两次 - 这意味着什么(例如 Var x = this.time = this.time || this.time(); )

javascript - 同位素附加似乎不起作用

google-chrome - iPhone 上的脉动文本

javascript - 如何将 WordPress 帖子 ID 传递到 HTML5 本地存储

javascript - 单击链接时 IE 会一次又一次弹出,而不是显示在同一屏幕中

javascript - 在 JavaScript 中维护特定的窗口层次结构