如果备案前已经备案了很多个网站,不用一一的去添加页面,给域名访问一个页面或者一个站点的时候,限制备案的审核比较严格,就需要域名对应页面要放正确的备案号下面我们可以利用js实现,下面以我网站的为案例:
代码语言:html复制 <footer>
<a href="https://beian.miit.gov.cn" id="miit" style="color: #000000" target="_blank">湘ICP备19003460号-1</a>
<a href="https://www.beian.gov.cn/portal/registersystemInfo?recordcode=44011102002930" id="beian" style="color: #000000" target="_blank" >粤公网安备44011102002930号</a>
<p>
<script>
const domain = location.host;
const config = {
'czmz.top': {
miit: '湘ICP备19003460号-1',
beian: '粤公网安备44011102002930号',
code: '44011102002930',
},
'czidc.vip': {
miit: '湘ICP备19003460号-2',
beian: '粤公网安备44011102003081号',
code: '44011102003081',
},
'0735.pro': {
miit: '湘ICP备19003460号-3',
beian: '粤公网安备44011102003089号',
code: '44011102003089',
},
'centos.club': {
miit: '湘ICP备19003460号-4',
beian: '粤公网安备44011102003201号',
code: '44011102003201',
},
};
for (const key in config) {
const pattern = new RegExp(key);
if (pattern.test(domain)) {
const item = config[key];
document.getElementById('miit').innerHTML = item.miit;
document.getElementById('beian').innerHTML = item.beian;
document.getElementById('beian').href = 'https://www.beian.gov.cn/portal/registersystemInfo?recordcode=' item.code;
}
}
</script>
</p>
</footer>