Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试从我的网站 url 获取主机名,但是当我制作 javascript 代码 var hostname = location.hostname 时,默认屏幕代码不会执行。如何从网址获取主机名。
你是什么意思“默认屏幕代码”?location.hostname是正确的 JS 代码来获得你正在寻找的东西。
location.hostname