Skip to content

Commit 5687dd2

Browse files
Create app.js
1 parent 1544913 commit 5687dd2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

h/app.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
document.addEventListener('DOMContentLoaded', function () {
2+
const websiteUrl = 'your_website_url';
3+
4+
fetch(websiteUrl)
5+
.then(response => response.text())
6+
.then(html => {
7+
const parser = new DOMParser();
8+
const doc = parser.parseFromString(html, 'text/html');
9+
10+
const hyperlinks = doc.querySelectorAll('a');
11+
12+
const hyperlinksContainer = document.getElementById('hyperlinks-container');
13+
hyperlinks.forEach(link => {
14+
const linkElement = document.createElement('a');
15+
linkElement.href = link.href;
16+
linkElement.textContent = link.href;
17+
hyperlinksContainer.appendChild(linkElement);
18+
});
19+
})
20+
.catch(error => {
21+
console.error('Error fetching website content:', error);
22+
});
23+
});

0 commit comments

Comments
 (0)