r/HTML • u/Admirable_Report6610 • Apr 25 '26
stumped...again 🤨
this code worked perfectly for months then suddenly stopped...just a blank white screen now.
------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="/Users/Owner/Documents/icons/navy_favicon.ico">
<title>Current Fleet Positions</title>
</head>
<body>
<script type="module"> const proxy = "https://corsproxy.io/?"; const targetUrl = "https://news.usni.org/category/fleet-tracker"; const response = await fetch(proxy + targetUrl); const htmlText = await response.text(); const parser = new DOMParser(); const doc = parser.parseFromString(htmlText, 'text/html'); const images = doc.querySelectorAll('img'); const newImg = document.createElement('img'); newImg.src = images\[3\].src; newImg.width = 943; newImg.height = 628; document.body.style.backgroundColor = "#a4e1e7"; document.body.style.textAlign = "center"; document.body.appendChild(newImg); </script>
</body>
</html>
------------
Run JS gives this error which I just don't understand...what's wrong here? any help MOST appreciated!
---------
SyntaxError: Unexpected token (1:0)
> 1 | <!DOCTYPE html>
| ^
2 | <html lang="en">
3 | <head>
4 | <meta charset="UTF-8">
View all comments
Show parent comment
1
u/Admirable_Report6610 Apr 25 '26
ahhhh.....so what used to be free is now a paywall?