Browser-Update.org customization

Browser-Update.org customization

本文关键字:customization org Browser-Update      更新时间:2023-09-26

我正在尝试从 Browser-Update.org 项目中实现脚本,该脚本检查浏览器版本并提示用户更新(如果他们使用的是旧版本)。可以在这里找到它。

他们的自定义文档中,它们允许您在显示信息栏时执行javascript:

onshow: function(infos){},      // callback function after the bar has appeared

我不知道在他们的脚本中插入它的哪个位置。我想在触发 onshow 时运行以下 javascript:

document.getElementById('Submit').disabled = true;

这是我尝试失败的方法:

<script> 
var $buoop = {c:2};
function $buo_f(){ 
 var e = document.createElement("script"); 
 e.src = "//browser-update.org/update.min.js"; 
 document.body.appendChild(e);
};
try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
catch(e){window.attachEvent("onload", $buo_f)}
onshow: function(infos){
    document.getElementById('Submit').disabled = true;
};
</script>

是一个真正的JavaScript新手,我对此感到迷茫。谢谢。-布莱恩

这是一种方式:

onshow: function(infos){
    document.getElementById('Submit').disabled = true;
},      // callback function after the bar has appeared

你也可以在其中调用一个函数。

如果您选择将其全部保留在那里,这将是完整的块。

<script> 
var $buoop = {
    vs: {i:6,f:2,o:9.63,s:2,c:10},  // browser versions to notify
    reminder: 24,                   // atfer how many hours should the message reappear
                                // 0 = show all the time
    reminderClosed: 150             // if the user closes message it reappears after x hours
    onshow: function(infos){
        document.getElementById('Submit').disabled = true;
    },      // callback function after the bar has appeared
    onclick: function(infos){},     // callback function if bar was clicked
    onclose: function(infos){},     //
    l: false,                       // set a language for the message, e.g. "en"
                                // overrides the default detection
    test: false,                    // true = always show the bar (for testing)
    text: "",                       // custom notification html text
                                // Optionally include up to two placeholders "%s" which will be replaced with the browser version and contents of the link tag. Example: "Your browser (%s) is old.  Please <a%s>update</a>"
    text_xx: "",                    // custom notification text for language "xx"
                                // e.g. text_de for german and text_it for italian
    newwindow: true                 // open link in new window/tab
    url: null                       // the url to go to after clicking the notification
};
function $buo_f(){ 
 var e = document.createElement("script"); 
 e.src = "//browser-update.org/update.min.js"; 
 document.body.appendChild(e);
};
try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
catch(e){window.attachEvent("onload", $buo_f)}
</script>