900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > js 设置window.open打开新窗口的title

js 设置window.open打开新窗口的title

时间:2022-06-16 09:13:17

相关推荐

js 设置window.open打开新窗口的title

方法一:缺陷:打开的新链接非同源时,不生效

const newWindow = window.open(url)newWindow.onload = () => {newWindow.document.title = fileInfo.appendixName}

方法二缺陷:h5的android端不支持

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);},this.openWindow(url, title)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。