export const safeOpen: typeof window.open = (url?: string, ...args) => {
if (/MicroMessenger/g.test(window.navigator.userAgent)) {
return window.open(url, ...args);
}
const newWindow = window.open('about:blank', ...args);
if (newWindow && url) {
console.log('safe open', url);
newWindow.location.href = url;
}
return newWindow;
};
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15