Skip to content

Commit

Permalink
Add frame reloading code to web tabs for code-server etc
Browse files Browse the repository at this point in the history
  • Loading branch information
tonykay committed Nov 23, 2024
1 parent c9cd277 commit cd654a9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
25 changes: 23 additions & 2 deletions ansible/roles/showroom/templates/service_web1/tab_web1.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@
allow="fullscreen"
referrerpolicy="no-referrer"
width="100%"
style="border:none;">
</iframe>
style="border:none;"
></iframe>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const iframe = document.getElementById('web1');
const originalSrc = iframe.src;
function reloadIframe() {
iframe.src = 'about:blank';
setTimeout(() => {
iframe.src = originalSrc;
}, 100);
}
// Reload on page load
reloadIframe();
// Handle manual page refreshes
window.addEventListener('beforeunload', function() {
iframe.src = 'about:blank';
});
});
</script>
21 changes: 21 additions & 0 deletions ansible/roles/showroom/templates/service_web2/tab_web2.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,24 @@
style="border:none;">
</iframe>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const iframe = document.getElementById('web2');
const originalSrc = iframe.src;
function reloadIframe() {
iframe.src = 'about:blank';
setTimeout(() => {
iframe.src = originalSrc;
}, 100);
}
// Reload on page load
reloadIframe();
// Handle manual page refreshes
window.addEventListener('beforeunload', function() {
iframe.src = 'about:blank';
});
});
</script>

0 comments on commit cd654a9

Please sign in to comment.