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
+18 -2
View File
@@ -14,13 +14,28 @@
<textarea id="userInput" placeholder="Type your message..." rows="5"></textarea> <textarea id="userInput" placeholder="Type your message..." rows="5"></textarea>
<button onclick="sendMessage()">Send</button> <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 src="/js/frontend.js"></script>
<script> <script>
const chatContainer = document.getElementById('chatbox'); const chatContainer = document.getElementById('chatbox');
// Handle resize events // Handle resize events
window.addEventListener('resize', function() { window.addEventListener('resize',
chatContainer.style.height = 'auto'; function() {
chatContainer.style.height = 'auto';
}); });
const userInputElement = document.getElementById('userInput'); const userInputElement = document.getElementById('userInput');
@@ -37,6 +52,7 @@
}); });
</script> </script>
</body> </body>
</html> </html>