Skip to content

Commit efdbc36

Browse files
committed
fix mobile bookmark contains image error
1 parent f75e76a commit efdbc36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

static/js/custom.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ async function html2Img(html) {
158158
div.setAttribute('style', 'padding: 30px 20px;background: #000;color: #f7f4cb;font-family: "LXGW WenKai";max-width: 768px;margin: auto;');
159159
div.innerHTML = html;
160160
let containImages = div.getElementsByTagName('img');
161+
if (containImages.length > 0 && window.mobileCheck()) {
162+
launch_toast("手机端不支持图片书签,请用电脑浏览器");
163+
return;
164+
}
161165
for (let i = 0; i < containImages.length; i++) {
162166
let originImg = containImages[i];
163167
let originImgSrc = originImg.getAttribute('src');
@@ -181,7 +185,6 @@ async function html2Img(html) {
181185
document.body = document.createElement("body");
182186
}
183187
document.body.appendChild(div);
184-
launch_toast("请稍等。。失败请用电脑浏览器尝试");
185188
let canvas = await html2canvas(div, {allowTaint: true, useCORS: true});
186189
if (window.mobileCheck()) {
187190
document.body = bodyBackup;

0 commit comments

Comments
 (0)