1
0
Fork 0
VelSite/scripts/framecheck.js
2025-08-12 14:54:45 -05:00

16 lines
668 B
JavaScript

// Check if we're contained in a frame
const inFrame = window.self !== window.top;
// If we're not in a frame, load the frameset with the requested page in mainFrame.
if (inFrame == false) {
document.getElementsByTagName('body')[0].outerHTML = `
<frameset cols="200,*" frameborder="no">
<frame src="/nav.htm" name="leftFrame" scrolling="yes" noresize>
<frame src="${document.URL}" name="mainFrame">
</frameset>
<noframes>Your browser doesn't seem to support frames, which is pretty unfortunate.</noframes>
`;
}
// Change browser address bar to match current page in mainFrame
// window.history.pushState(null, null, document.URL);