index.html
文件内容
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta name="referrer" content="no-referrer" />
<title>Mendix</title>
<script type="text/javascript">
// 定义全局 hash
globalThis.hash = Math.floor(Math.random() * 0xffffff).toString(16);
try {
eval("async () => {}");
} catch (error) {
var homeUrl = window.location.origin + window.location.pathname;
var appUrl = homeUrl.slice(0, homeUrl.lastIndexOf("/") + 1);
window.location.replace(appUrl + "unsupported-browser.html");
}
</script>
</head>
<body>
<noscript>To use this application, please enable JavaScript.</noscript>
<div id="content"></div>
</body>
<script type="text/javascript">
dojoConfig = {
isDebug: false,
useCustomLogger: true,
async: true,
baseUrl: "mxclientsystem/dojo/",
cacheBust: globalThis.hash,
rtlRedirect: "index-rtl.html",
};
// 需要添加script标签的地方
const jsSrcList = [ "mxclientsystem/mxui/mxui.js" ];
for (const src of jsSrcList) {
const scriptEl = document.createElement("script");
scriptEl.src = `${src}?s=${globalThis.hash}`;
document.body.appendChild(scriptEl);
}
// 加载 link 标签
const iconList = [
// manifest
{
rel: "manifest",
href: "manifest.webmanifest",
crossorigin: "use-credentials",
},
// main.scss 编译之后文件
{ rel: "stylesheet", href: "theme.compiled.css" },
// icon
{
rel: "apple-touch-icon",
href: "apple-touch-icon.png",
sizes: "180x180",
},
{ rel: "icon", href: "icon-32.png", sizes: "32x32" },
{ rel: "icon", href: "icon-16.png", sizes: "16x16" },
// apple-touch-startup-image
{
custorm: true,
width: 1024,
height: 1366,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 1366,
height: 1024,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 834,
height: 1194,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 1194,
height: 834,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 834,
height: 1112,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 1112,
height: 834,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 810,
height: 1080,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 1080,
height: 810,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 768,
height: 1024,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 1024,
height: 768,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 428,
height: 926,
devicePixelRatio: 3,
orientation: "portrait",
},
{
custorm: true,
width: 926,
height: 428,
devicePixelRatio: 3,
orientation: "landscape",
},
{
custorm: true,
width: 390,
height: 844,
devicePixelRatio: 3,
orientation: "portrait",
},
{
custorm: true,
width: 844,
height: 390,
devicePixelRatio: 3,
orientation: "landscape",
},
{
custorm: true,
width: 360,
height: 780,
devicePixelRatio: 3,
orientation: "portrait",
},
{
custorm: true,
width: 780,
height: 360,
devicePixelRatio: 3,
orientation: "landscape",
},
{
custorm: true,
width: 414,
height: 896,
devicePixelRatio: 3,
orientation: "portrait",
},
{
custorm: true,
width: 896,
height: 414,
devicePixelRatio: 3,
orientation: "landscape",
},
{
custorm: true,
width: 414,
height: 896,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 896,
height: 414,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 375,
height: 812,
devicePixelRatio: 3,
orientation: "portrait",
},
{
custorm: true,
width: 812,
height: 375,
devicePixelRatio: 3,
orientation: "landscape",
},
{
custorm: true,
width: 375,
height: 667,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 667,
height: 375,
devicePixelRatio: 2,
orientation: "landscape",
},
{
custorm: true,
width: 414,
height: 736,
devicePixelRatio: 3,
orientation: "portrait",
},
{
custorm: true,
width: 736,
height: 414,
devicePixelRatio: 3,
orientation: "landscape",
},
{
custorm: true,
width: 320,
height: 568,
devicePixelRatio: 2,
orientation: "portrait",
},
{
custorm: true,
width: 568,
height: 320,
devicePixelRatio: 2,
orientation: "landscape",
},
];
for (const items of iconList) {
const link = document.createElement("link");
if (items.custorm) {
link.rel = "apple-touch-startup-image";
link.href = `img/startup-image-${
items.width * items.devicePixelRatio
}x${items.height * items.devicePixelRatio}.png?${globalThis.hash}`;
link.media = `screen and (device-width: ${items.width}px) and (device-height: ${items.height}px) and (-webkit-device-pixel-ratio: ${items.devicePixelRatio}) and (orientation: ${items.orientation})`;
} else {
link.rel = items.rel;
if (items.sizes) {
link.sizes = items.sizes;
}
if (items.crossorigin) {
link.crossorigin = items.crossorigin;
}
link.href = `${items.href}?l=${globalThis.hash}`;
}
document.head.appendChild(link);
}
// 处理登录页面的 cookie
if (!document.cookie || !document.cookie.match(/(^|;) *originURI=/gi)) {
const url = new URL(window.location.href);
const subPath = url.pathname.substring(0, url.pathname.lastIndexOf("/"));
document.cookie = `originURI=${subPath}/login.html${
window.location.protocol === "https:" ? ";SameSite=None;Secure" : ""
}`;
}
</script>
</html>