-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappmaker.html
More file actions
110 lines (90 loc) · 4.58 KB
/
Copy pathappmaker.html
File metadata and controls
110 lines (90 loc) · 4.58 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Full-Screen iFrame Loader</title>
<!-- Load Tailwind CSS for styling -->
<script src="https://cdn.tailwindcss.com"></script>
<style>
/* Basic font setup */
body {
font-family: 'Inter', sans-serif;
}
</style>
</head>
<body class="bg-gray-100">
<!-- Input container, centered on the page -->
<div id="input-container" class="flex items-center justify-center min-h-screen">
<div class="bg-white p-8 rounded-lg shadow-xl w-full max-w-md">
<h1 class="text-2xl font-bold text-center text-gray-800 mb-6">Website Loader</h1>
<div class="space-y-4">
<label for="url-input" class="block text-sm font-medium text-gray-700">Enter a website URL:</label>
<input type="text" id="url-input" placeholder="https://example.com" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<button id="load-btn" class="w-full bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition duration-200">
Load Website
</button>
</div>
<p class="text-xs text-gray-500 text-center mt-6">
<strong>Note:</strong>This is not a proxy and Many websites (like Google, Facebook, etc.) block being loaded in an iframe due to security settings (<code>X-Frame-Options</code>). If you see a blank page, this is likely why.
</p>
</div>
</div>
<!-- iFrame container, initially hidden -->
<div id="iframe-container" class="hidden fixed top-0 left-0 w-full h-full z-50">
<!-- The iframe will display the website -->
<iframe id="content-frame" class="w-full h-full border-0" src="about:blank"></iframe>
<!-- Close button, overlaid on top of the iframe -->
<button id="close-btn" class="fixed top-4 right-4 bg-red-600 text-white font-bold py-2 px-4 rounded-lg shadow-lg hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 z-[60]">
× Close
</button>
</div>
<script>
// Get references to all the important elements
const inputContainer = document.getElementById('input-container');
const urlInput = document.getElementById('url-input');
const loadBtn = document.getElementById('load-btn');
const iframeContainer = document.getElementById('iframe-container');
const contentFrame = document.getElementById('content-frame');
const closeBtn = document.getElementById('close-btn');
// Function to show the iframe and hide the input
function showFrame() {
let url = urlInput.value.trim();
// If no URL is entered, do nothing
if (!url) {
urlInput.focus();
return;
}
// Automatically add https:// if no protocol is specified
if (!url.startsWith('http://') && !url.startsWith('https://')) {
url = 'https://' + url;
}
// Set the iframe source and show it
contentFrame.src = url;
iframeContainer.classList.remove('hidden');
inputContainer.classList.add('hidden');
}
// Function to hide the iframe and show the input
function hideFrame() {
// Clear the iframe source to stop any loading
contentFrame.src = 'about:blank';
// Hide the iframe and show the input container
iframeContainer.classList.add('hidden');
inputContainer.classList.remove('hidden');
// Optional: clear the input field
// urlInput.value = '';
}
// --- Event Listeners ---
// Load the website when the button is clicked
loadBtn.addEventListener('click', showFrame);
// Also load the website if the user presses "Enter" in the input field
urlInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
showFrame();
}
});
// Hide the iframe when the close button is clicked
closeBtn.addEventListener('click', hideFrame);
</script>
</body>
</html>