// ページ内のすべてのアンカー要素を取得
const anchors = document.querySelectorAll('a');
// アンカーのhref属性を配列に格納
const urls = Array.from(anchors).map(anchor => anchor.href);
// 結果をコンソールに表示
console.log(urls);
Last active
October 14, 2024 02:32
-
-
Save hdknr/b9da430dc87e11d78397a4edff1f7aa3 to your computer and use it in GitHub Desktop.
javascript: ページのURLを取得
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment