不好意思,提问的不够好,先上源码
document.write(''.replace(/%url%/, encodeURIComponent(location.href)));
一个分享微博的功能,我理解不了这句。
replace(/%url%/, encodeURIComponent(location.href))
/%url%/到底替换了什么?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
做了一个宏替换
将location.ref encode之后,替换掉%url%宏