Hämntar ut apiEndpoint från fönstret som koden exekverar i (en iframe)

This commit is contained in:
Joakim Persson
2024-07-27 22:44:32 +02:00
parent 25e5c6acea
commit f8c3bcd156
+17 -1
View File
@@ -14,12 +14,27 @@
<textarea id="userInput" placeholder="Type your message..." rows="5"></textarea>
<button onclick="sendMessage()">Send</button>
<!-- Get the apiEndpoint -->
<script>
const apiEndpoint = window.apiEndpoint;
// Debugging log messages
// if (apiEndpoint) {
// console.log("client.html - apiEndpoint: ", apiEndpoint);
// }
// else {
// console.log("client.html - cannot find apiEndpoint");
// }
</script>
<!-- Get the javascript handling communication with the backene -->
<script src="/js/frontend.js"></script>
<script>
const chatContainer = document.getElementById('chatbox');
// Handle resize events
window.addEventListener('resize', function() {
window.addEventListener('resize',
function() {
chatContainer.style.height = 'auto';
});
@@ -37,6 +52,7 @@
});
</script>
</body>
</html>