0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ブラウザで表示されているリンク取得

Posted at

ブラウザで表示されているリンク取得

// すべてのリンクの href 属性を取得してコンソールに表示する
const links = Array.from(document.querySelectorAll('a'));
const hrefs = links.map(link => link.href).filter(href => href);

// すべてのリンクをコンソールに出力
console.log("リンク一覧:");
hrefs.forEach(href => console.log(href));

// クリップボードにコピー
const textToCopy = hrefs.join('\n');
navigator.clipboard.writeText(textToCopy)
.then(() => console.log("すべてのリンクがクリップボードにコピーされました。"))
.catch(err => console.error("コピーに失敗しました: ", err));

0
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?