Disable using the full website in an iframe #446
This commit is contained in:
parent
009e3cbfc3
commit
c4955b39de
20
sandbox/embed_full_website.html
Normal file
20
sandbox/embed_full_website.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
|
||||
<title>Online 3D Viewer</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe
|
||||
src="../../website#model=assets/models/solids.obj,assets/models/solids.mtl"
|
||||
width="640" height="480"
|
||||
style="border:1px solid #eeeeee;">
|
||||
</iframe>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -130,6 +130,18 @@ div.intro div.intro_file_formats a:hover
|
||||
background: var(--ov_outline_button_hover_color);
|
||||
}
|
||||
|
||||
div.noembed
|
||||
{
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
div.noembed a
|
||||
{
|
||||
padding: 10px 0px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.main
|
||||
{
|
||||
overflow: hidden;
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import { SetExternalLibLocation } from '../engine/io/externallibs.js';
|
||||
import { Loc } from '../engine/core/localization.js';
|
||||
import { AddDiv, AddDomElement } from '../engine/viewer/domutils.js';
|
||||
import { Embed } from './embed.js';
|
||||
import { Website } from './website.js';
|
||||
import { SetEventHandler, HandleEvent } from './eventhandler.js';
|
||||
import { PluginType, RegisterPlugin } from './pluginregistry.js';
|
||||
import { ButtonDialog, ProgressDialog } from './dialog.js';
|
||||
import { ShowMessageDialog } from './dialogs.js';
|
||||
import { Loc } from '../engine/core/localization.js';
|
||||
|
||||
import * as Engine from '../engine/main.js';
|
||||
export { Engine };
|
||||
@ -48,8 +49,16 @@ export function RegisterToolbarPlugin (plugin)
|
||||
export function StartWebsite (externalLibLocation)
|
||||
{
|
||||
SetExternalLibLocation (externalLibLocation);
|
||||
|
||||
window.addEventListener ('load', () => {
|
||||
if (window.self !== window.top) {
|
||||
let noEmbeddingDiv = AddDiv (document.body, 'noembed');
|
||||
AddDiv (noEmbeddingDiv, null, Loc ('Embedding Online 3D Viewer in an iframe is not supported.'));
|
||||
let link = AddDomElement (noEmbeddingDiv, 'a', null, Loc ('Open Online 3D Viewer'));
|
||||
link.target = '_blank';
|
||||
link.href = window.self.location;
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById ('intro_dragdrop_text').innerHTML = Loc ('Drag and drop 3D models here.');
|
||||
document.getElementById ('intro_formats_title').innerHTML = Loc ('Check an example file:');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user