Skickar apiEndpoint till iframe genom att sätta contentWindow.apiEndpoint
This commit is contained in:
@@ -4,19 +4,25 @@
|
|||||||
<!-- <title>Frontend</title> -->
|
<!-- <title>Frontend</title> -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
|
||||||
// Extract apiEndpoint for use in your frontend code...
|
|
||||||
const apiEndpoint = '{{ api_endpoint }}'; // Templating syntax (Jinja2)
|
|
||||||
console.log("index.html - API Endpoint: ", apiEndpoint);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- This iframe will hold the content from client.html -->
|
<!-- This iframe will hold the content from client.html -->
|
||||||
<!-- Passing the API endpoint as a query parameter to the srcdoc attribute -->
|
<!-- Passing the API endpoint as a query parameter to the srcdoc attribute -->
|
||||||
|
<!-- srcdoc="{{ client_content }}?apiEndpoint={{ api_endpoint }}/"> -->
|
||||||
|
|
||||||
<iframe id="client-frame"
|
<iframe id="client-frame"
|
||||||
style="width: 100%; height: 100vh;"
|
style="width: 100%; height: 100vh;"
|
||||||
srcdoc="{{ client_content }}?apiEndpoint={{ api_endpoint }}/">
|
srcdoc="{{ client_content }}">
|
||||||
</iframe>
|
</iframe>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Extract apiEndpoint for use in your frontend code...
|
||||||
|
const apiEndpoint = '{{ api_endpoint }}'; // Templating syntax (Jinja2)
|
||||||
|
// Tell the iframe about the apiEndpoing
|
||||||
|
document.getElementById('client-frame').contentWindow.apiEndpoint = apiEndpoint;
|
||||||
|
console.log("index.html - API Endpoint: ", apiEndpoint);
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- Responsive scaling and some padding -->
|
<!-- Responsive scaling and some padding -->
|
||||||
<script>
|
<script>
|
||||||
const clientFrame = document.getElementById('client-frame');
|
const clientFrame = document.getElementById('client-frame');
|
||||||
|
|||||||
Reference in New Issue
Block a user