-
Notifications
You must be signed in to change notification settings - Fork 0
/
store_proxy.html
37 lines (35 loc) · 1.32 KB
/
store_proxy.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
---
layout: default
permalink: /store_proxy/
---
<div class="container">
<strong>Store Page: </strong><a href="about:blank" id="main_url" target="_blank"></a>
<div id="main_content">
Loading...
</div>
</div>
<script>
async function loadStorePage() {
try {
const url = new URLSearchParams(window.location.search).get('url')
const fullUrl = `https://store.korge.org/${url}`;
document.querySelector("#main_url").innerText = fullUrl;
document.querySelector("#main_url").href = fullUrl
const result = await fetch(fullUrl)
const resultText = await result.text()
const dom = new DOMParser().parseFromString(resultText, "text/html")
const node = dom.querySelector("#main_content")
//console.log(dom)
//console.log(node)
document.querySelector("#main_content").innerHTML = node.innerHTML
//console.log(resultText)
//document.querySelector('#myiframe').src = fullUrl
//console.log(fullUrl);
} catch (e) {
//document.querySelector("#main_content").textContent = `ERROR: ${e}\n${e.stack}`;
document.querySelector("#main_content").textContent = `ERROR: ${e}`;
console.error(e)
}
}
loadStorePage()
</script>