<!DOCTYPE html>
<html>
<head>
<title>広告チェッカー</title>
</head>
<body>
<h1>広告チェッカー</h1>
<label for="url">URL:</label>
<input type="text" id="url" name="url" placeholder="http://example.com">
<button onclick="checkAds()">チェック</button>
<div id="result"></div>
<script>
function checkAds() {
const url = document.getElementById("url").value;
// URLの妥当性をチェック
if (!url.includes("http")) {
document.getElementById("result").textContent = "有効なURLを入力してください";
return;
}
// オンラインでリクエスト
fetch(url)
.then(response => response.text())
.then(data => {
// 広告を含むかどうかをチェック
if (data.includes("ad") || data.includes("広告")) {
document.getElementById("result").textContent = "このサイトには広告が含まれています。";
} else {
document.getElementById("result").textContent = "このサイトには広告が含まれていません。";
}
})
.catch(error => console.error(error));
}
</script>
</body>
</html>
※ジョークは割愛しました。