Spaces:
Running
Running
Commit
·
1cdfb96
1
Parent(s):
0f03dc6
rm: index.js
Browse files
index.js
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
function createIframeHandler() {
|
2 |
-
let iframe = document.getElementById('link-frame');
|
3 |
-
if (!iframe) {
|
4 |
-
iframe = document.createElement('iframe');
|
5 |
-
iframe.id = 'link-frame';
|
6 |
-
iframe.style.position = 'absolute';
|
7 |
-
iframe.style.width = '1px';
|
8 |
-
iframe.style.height = '1px';
|
9 |
-
iframe.style.right = '-100px';
|
10 |
-
iframe.style.bottom = '-100px';
|
11 |
-
iframe.style.display = 'none'; // Hidden initially
|
12 |
-
document.body.appendChild(iframe);
|
13 |
-
}
|
14 |
-
|
15 |
-
document.addEventListener('click', function (event) {
|
16 |
-
var link = event.target.closest('a');
|
17 |
-
if (link && link.href) {
|
18 |
-
try {
|
19 |
-
iframe.src = link.href;
|
20 |
-
iframe.style.display = 'block'; // Show iframe on link click
|
21 |
-
event.preventDefault();
|
22 |
-
console.log('Opening link in iframe:', link.href);
|
23 |
-
} catch (error) {
|
24 |
-
console.error('Failed to open link in iframe:', error);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
});
|
28 |
-
|
29 |
-
return 'Iframe handler initialized';
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|