Featured image of post Copy text from website

Copy text from website

📌 Introduction

When a web page contains text that cannot be copied, these methods make the page editable so that the text can be copied.

當遇到無法複製文字的網頁,這些方式可以將網頁變成可編輯的模式,這樣就可以直接複製原本無法被複製的文字。

💻 Code

// Method 1
document.designMode = 'on';

// Method 2
document.body.contentEditable = 'true';

 

Licensed under CC BY-NC-SA 4.0
Last updated on Nov 20, 2023 14:48 CST