v26110901 小程序里进应用改为打开容器页,「复制链接」直达应用
首页宫格/记一下/工具卡/档案/底栏跳应用:在小程序里 navigateTo pages/annex/web_view/index?url=<净地址>, 小程序当前页就是该应用,复制链接、转发都直达;url 去掉 openid/unionid/__no_identity/return_url, 不带分享人身份。不在小程序或 navigateTo 失败照旧 location.href。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -105,6 +105,16 @@
|
||||
}
|
||||
if (window.wxAuth && wxAuth.reportLocation) wxAuth.reportLocation({ href: target });
|
||||
} catch (e) {}
|
||||
/* 11-09:小程序里开容器页,「复制链接」才能直达这个应用(同 js/app.js openInHost,url 只放净地址) */
|
||||
var mp = window.wx && window.wx.miniProgram;
|
||||
if ((window.__wxjs_environment === 'miniprogram' || /miniProgram/i.test(navigator.userAgent)) && mp && typeof mp.navigateTo === 'function') {
|
||||
try {
|
||||
var c = new URL(url, location.origin);
|
||||
['openid', 'unionid', '__no_identity', 'return_url'].forEach(function (k) { c.searchParams.delete(k); });
|
||||
mp.navigateTo({ url: '/pages/annex/web_view/index?url=' + encodeURIComponent(c.href), fail: function () { location.href = target; } });
|
||||
return;
|
||||
} catch (e) {}
|
||||
}
|
||||
location.href = target;
|
||||
}
|
||||
var tt;
|
||||
|
||||
Reference in New Issue
Block a user