存有一個布林值,true 表示瀏覽器是上線,false 是離線。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.onLine );
</script> - 執行結果:
true
- Safari, Chrome 無此項;IE, Firefox 都有支援。
存放作業系統的字串。限 Firefox 使用。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.oscpu );
</script> - 執行結果:
undefined
存有瀏覽器的平台字串。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.platform );
</script> - 執行結果:
Linux x86_64
存放一個陣列,內有瀏覽器安裝的插頭軟體。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.plugins.length +'<br />');
for( k in navigator.plugins[0] )
document.write( k +' : '+ navigator.plugins[0][k] +'<br />');
</script> - 執行結果:
0
- IE 沒有輸出;Firefox, Safari, Chrome 都有輸出,但是有差異。
存有瀏覽器的商品名稱。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.product );
</script> - 執行結果:
Gecko
- IE, 無此項;Firefox, Safari, Chrome 都輸出”Gecko”。
存有瀏覽器的建造編號。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.productSub );
</script> - 執行結果:
20030107
- IE, 無此項;Firefox, Safari, Chrome 都支援。
存有瀏覽器的用戶執行器字串。
- 程式用法:
<script type='text/javascript'>
document.write( navigator.userAgent );
</script> - 執行結果:
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)