Preserving newline characters in data:text URI

前端 未结 2 1841
小蘑菇
小蘑菇 2021-01-14 04:53

I have a button in my extension that triggers the following code:

chrome.tabs.create({url: \'data:text;base64,\'+btoa(data), active:false});
<
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 05:16

    For all who try to preserve newline characters in a data URI without base64 encryption: this is not possible, you have to use base64 encoding.

提交回复
热议问题