function openWindow (url, title) {
const newWindow = window.open('about:blank', title);
newWindow.document.title = title;
let iframe = document.createElement('iframe');
iframe.src = url;
iframe.style.width = '100%';
iframe.style.height = '100vh';
iframe.style.margin = '0';
iframe.style.padding = '0';
iframe.style.overflow = 'hidden';
iframe.style.border = 'none';
newWindow.document.body.style.margin = '0';
newWindow.document.body.appendChild(iframe);
}
openWindow("https://www.baidu.com","百度文心有点傻");
window.open 自定义标题 完美解决方案
最新推荐文章于 2024-07-18 17:08:00 发布