通过 a 标签巧妙获得链接的 host protocol
2020-05-20 本文已影响0人
在幽幽暗暗反反复复中追问
const urlNode = document.createElement('a')
urlNode.setAttribute('href', 'http://xxx:8080')
const { host, protocol } = urlNode
const urlNode = document.createElement('a')
urlNode.setAttribute('href', 'http://xxx:8080')
const { host, protocol } = urlNode