JavaScript protocol 属性

location.protocol -- 返回URL中的协议部分。例如 http://www.dreamdu.com:8080/xhtml/ 返回(//)前面的内容http:
  • protocol,中文"规约"的意思
  • 引用网址:http://www.dreamdu.com/javascript/location.protocol/

protocol属性语法

location.protocol;

protocol属性图示

location对象属性

protocol属性说明

常见的协议有http ftp smtp telnet https等,例如:

ftp://www.dreamdu.com/ 的location.protocol将返回ftp:

示例

document.writeln(location.protocol);

JavaScript protocol 属性示例 -- 可以尝试编辑

延伸阅读



  • 教程中有什么不懂的地方?发现教程的错误!对教程有什么建议!快快给我留言呀 给猴子留言,我会尽快解答你的问题:)
  • HTML代码