16 lines
527 B
TypeScript
16 lines
527 B
TypeScript
/** Browser restrictions for the local Markdown export dialog. */
|
|
|
|
export function detectPrintRestriction(userAgent?: string): {
|
|
restricted: boolean;
|
|
message?: string;
|
|
} {
|
|
const ua = typeof userAgent === "string" ? userAgent : typeof navigator !== "undefined" ? navigator.userAgent : "";
|
|
if (/MicroMessenger/i.test(ua)) {
|
|
return {
|
|
restricted: true,
|
|
message: "微信内置浏览器可能无法完整打印,请在系统浏览器中打开本页后打印。",
|
|
};
|
|
}
|
|
return { restricted: false };
|
|
}
|