2017-10-18 101 views
0

當前功能正在運行並且已運行多年,但在過去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/

只要找到了「鐵木耳黑」甲板列表,點擊圖像上面的例子圖標:Deckilst icon

我似乎無法弄清楚是什麼導致它在Chrome中導致它打開一個空白窗口時,它曾經工作正常,它可能是一個SSL的東西?

感謝

回答

0

它不工作對鉻,但你可以像使用替代解決方案:

var w = window.open(""); 
w.document.write('Your Text Here'); 

它的工作在所有主要的瀏覽器。

+0

這種幫助,但我需要保存在.txt文件中以便快速下載。 –

0

我最終得到它使用Ahmed的方法工作,但我不得不解碼的URI和<br>取代休息,我認爲它會正常工作。

var win = window.open(); 
win.document.write(decodeURIComponent($(this).attr('data-modo')).replace(/(?:\r\n|\r|\n)/g, '<br/>')); 
win.focus(); 

但是,如果任何人有其他答案保持使用文本讓我知道。