Skip to content

Leon406/cdn.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

静态CDN资源失效自动切换

⚠️ 此库作为本地资源加载,不要用cdn加载

使用方式

<head>
    ...
    <script type="text/javascript" src="dist/cdn.js"></script>
    <script type="text/javascript">
        <!--   You should specify the package, version,ile, and your local resource path     -->
        loadCdnResource("jquery", "3.6.3", "jquery.min.js", "local.js", 2000)
        <!--   and also can custom total CDN check timeout for quick response     -->
        loadCdnResource("jquery", "3.6.3333", "jquery.min.js", "local.js", 2000)
    </script>
    ...
</head>

备选服务方式,有默认cdn, 仅在CDN服务宕机后重新加载

<head>
    ...
    <script type="text/javascript" src="https://cdn.staticfile.org/jquery/3.6.3.3/jquery.min.js"></script>
    <script type="text/javascript" src="dist/cdn.js"></script>
    <script type="text/javascript">
        !window.jQuery&&loadCdnResource("jquery", "3.6.3", "jquery.min.js", "local.js")
    </script>
    ...
</head>

CDN

国内CDN

国外CDN

About

静态CDN资源失效自动切换

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages