Use local css file if link to online css file is dead

前端 未结 3 443
一个人的身影
一个人的身影 2021-01-23 09:32

The problem:


I am using w3.css(if you enter now w3schools.com site is down for maintenance) for styling my website.The problem

3条回答
  •  孤街浪徒
    2021-01-23 09:52

    for check if w3.css is working you can use something like this. instead of src put w3.css image of logo or something .

    function checkImage (src, up, down) {
        var img = new Image();
        img.onload = up; 
        img.onerror = down;
        img. src = src;
    }
    
    checkImage( "https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", function(){ alert("up"); }, function(){ alert("down"); } );

提交回复
热议问题