![](/img/trans.png)
[英]How can I detect if Flash Player is disabled in a browser using JavaScript?
[英]How can I detect whether JavaScript is disabled using prototype?
如何使用原型庫檢測是否禁用了JavaScript? 我不想使用<noscript>
標簽; 我想使用原型提供的東西。
使用javascript來檢測javascript是否被禁用將非常困難。
要回答您的子問題,如果您想模擬<noscript>
標記行為而不使用noscript,請創建一個<div>
元素,其中包含要顯示給非JavaScript用戶的內容,然后在DOMReady事件中使用javascript將其隱藏。 它將執行與noscript標簽完全相同的操作。
<script type="Text/JavaScript">
document.observe("dom:loaded", function() {
$('simulate_noscript').hide();
});
</script>
<div id="simulate_noscript">
This is some content only users with JS disabled will see.
</div>
由於原型是JavaScript,因此您不能使用它來檢測是否禁用了Javascript。 您必須使用<noscript>
標記。
您無法檢測到使用javascript禁用了javascript。 Google正常降級,並逐步增強。
您不能使用JavaScript來確定是否啟用了JavaScript。 如果不是,那么腳本將永遠不會運行。 相反,請嘗試使用腳本本身注入需要腳本的行為。 這是逐步增強的核心原則。
嗯,如果禁用了Javascript,原型永遠也不會運行我的朋友。
原型是一個JavaScript框架。 如果禁用了JavaScript,則Prototype將不會運行,從而使啟用JavaScript的檢查無效。
您將需要使用<noscript>
標記來處理禁用JavaScript的情況。
只是以為我已經在無數評論中添加了這個問題,即如何使用禁用了javascript的javascript。 當然,請確保其性能良好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.