Javascript 我有一个窗口已设置为在';window.top';-需要在新窗口中打开
需要在新窗口中打开最终目标URL,而不是在“window.top”中。我需要在下面更改什么?(这是其他人写的,无法访问)Javascript 我有一个窗口已设置为在';window.top';-需要在新窗口中打开,javascript,window,Javascript,Window,需要在新窗口中打开最终目标URL,而不是在“window.top”中。我需要在下面更改什么?(这是其他人写的,无法访问) if(window.self==window.top){ 最终风险值https://www.amazon.com', iframes=document.querySelectorAll('iframe'), iframeLoaded=0; []forEach.call(iFrame、函数(项){ item.onload=函数(){ 装载框架(); } }) } 函数load
if(window.self==window.top){
最终风险值https://www.amazon.com',
iframes=document.querySelectorAll('iframe'),
iframeLoaded=0;
[]forEach.call(iFrame、函数(项){
item.onload=函数(){
装载框架();
}
})
}
函数loadFrames(){
iframeload++;
if(iframeLoaded==iframes.length){
location.href=finalDest;
}
}
您是否在询问如何打开新窗口?搜索“javascript打开新窗口”将产生window.open()
我需要在这个脚本的上下文中完成它。
<script>
if (window.self === window.top) {
var finalDest = 'https://www.amazon.com',
iframes = document.querySelectorAll('iframe'),
iframeLoaded = 0;
[].forEach.call(iframes, function(item) {
item.onload = function() {
loadFrames();
}
})
}
function loadFrames() {
iframeLoaded++;
if (iframeLoaded === iframes.length) {
location.href = finalDest;
}
}
</script>