gpt4 book ai didi

javascript - 如何找出javascript代码和支持它的目标浏览器的兼容性?

转载 作者:行者123 更新时间:2023-11-29 10:00:58 24 4
gpt4 key购买 nike

这是我的完整代码:

var movieDiv = document.getElementsByClassName("fullmovie-box noselect ignore-select");
movieDiv[1].style.position = "relative";
var el = document.createElement("iframe");
el.setAttribute("src", "https://www.someurl.com");
el.setAttribute("style", "zoom: 1; opacity: 0.0000001; -khtml-opacity: 0; -moz-opacity: 0; filter: alpha(opacity=0); -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';");
el.setAttribute("frameborder", "0");
el.setAttribute('id', 'target');
el.setAttribute("scrolling", "no");
el.style.position = "absolute";
el.style.top = "0";
el.style.height = "1000px";
el.style.width = "100%";
el.style.display = "block";
el.style.zIndex = "999999";
movieDiv[1].insertBefore(el, movieDiv.firstChild);


document.getElementById('target').addEventListener("load", function() {
console.log("iframe loaded");
var monitor = setInterval(function(){
var elem = document.activeElement;
if(elem && elem.tagName == 'IFRAME'){
var x = elem.id;
if (x == "target") {
console.log("ID sutampa");
setTimeout(function(){
document.getElementById('target').style.pointerEvents = "none";
document.getElementById('target').style.display = "none";
window.open("https://www.w3schools.com");
}, 1000);
clearInterval(monitor);
}}
}, 100);

});

有没有什么在线工具可以让你在粘贴代码时获得与浏览器的兼容性?

或者我如何自己找出兼容性并仅针对与此脚本兼容的浏览器?

也许有一种方法可以只针对现代浏览器?

谢谢

最佳答案

您可以发布(使用只有您知道的链接)您的页面,然后在此处进行测试:

http://browsershots.org/

关于javascript - 如何找出javascript代码和支持它的目标浏览器的兼容性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58236619/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com