0
現在,像'//abc.com'這樣的網址,電子會自動重定向到'file://abc.com'。有沒有辦法將https
協議頭添加到該網址而不是file
?如何在電子郵件地址中添加協議,如'//abc.com'?
現在,像'//abc.com'這樣的網址,電子會自動重定向到'file://abc.com'。有沒有辦法將https
協議頭添加到該網址而不是file
?如何在電子郵件地址中添加協議,如'//abc.com'?
const shell = require('electron').shell;
webContents.on('new-window', function(event, url){
event.preventDefault();
if (url.startsWith('//')) {
url = 'https:' + url;
}
shell.openExternal(url)
});
感謝您的評論!我的情況有點不同,我有一些資源在創建窗口後會被請求,如何強制所有外部資源加載同步或異步通過「https」? – Blake