สำหรับนักพัฒนาเวปไซต์ที่อยากรู้อยากเห็นทั้งหลาย (รวมทั้งผมด้วย) คงเคยใช้ firebug ไปลองแกะหน้าของ gmail ดูว่ามันทำยังไงมันถึงได้เร็วขนาดนี้ แล้วก็จะเห็นแจ้งเตือนว่า firebug ทำให้การใช้งานของท่านช้าลงนะ วันนี้เลยเอาวิธีทำแจ้งเตือนแบบนี้มาเก็บไว้ให้ดูเล่นๆ กัน
จาก WikiBall
How to
<script type="text/javascript">
if( window.console && window.console.firebug )
document.getElementsByTagName('body')[0].innerHTML +=
"<div onclick=\"this.style.display = 'none'\" "+
"style='position:absolute; top:0; width:100%; padding: 5px 0; background: #ff7; border-bottom: 1px solid #770; font-weight: bold; text-align: center;'>"+
"Firebug can make this web page slow, we suggest you disable it for this web page. Click to close this warning.</div>";
</script>
เพียงแค่เพิ่ม script ด้านบน ก็สามารถแจ้งเตือนผู้ใช้ได้แล้วว่าท่านกำลังเปิด firebug อยู่ ซึ่งอาจทำให้การดูเวปไซต์ของท่านนั้นช้าลง เหมือนตัวอย่างเช่น gmail นั่นเอง
Reference
- http://www.unwrongest.com/blog/if-firebug-slows-down-your-web-page-make-a-suggestion/
- http://blog.dkferguson.com/index.cfm/2009/3/31/Block-Firebug-on-your-site/

0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.