-
Notifications
You must be signed in to change notification settings - Fork 0
/
test3.html
75 lines (66 loc) · 2.85 KB
/
test3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
</head>
<body>
<header class="my-5 py-3"></header>
<!-- <section>
<div class="container">
<div class="row">
<div class="col-md-4 col-12"></div>
<div class="col-md-4 col-12">
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<p class="text-center display-2 mt-3" id="demo">?</p>
<div class="card-body">
<form>
<div class="mb-3">
<label class="form-label">1st No</label>
<input type="number" class="form-control" id="noone" value="2">
</div>
<div class="mb-3">
<label class="form-label">2nd No</label>
<input type="number" class="form-control" id="notwo" value="3">
</div>
<button type="button" class="btn btn-primary" onclick="result();">Calculate</button>
</form>
</div>
</div>
</div>
<div class="col-md-4 col-12"></div>
</div>
</div>
</section> -->
</body>
<script>
// Replace 'example.com' with the URL of the website you want to check
const url = 'https://nivesguru.in';
fetch(url)
.then(response => response.text())
.then(html => {
// Create a temporary DOM element to parse the HTML
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
// Get the title element
const titleElement = doc.querySelector('title');
if (titleElement) {
// Get the text content of the title element
const title = titleElement.textContent;
// Calculate the character length of the title
const characterLength = title.length;
console.log(`Title: ${title}`);
console.log(`Character Length: ${characterLength}`);
} else {
console.log('Title not found on the webpage.');
}
})
.catch(error => {
console.error('Error fetching or parsing the webpage:', error);
});
</script>
</html>