Javascript - Enabling


Tất cả các trình duyệt hiện đại đều có hỗ trợ sẵn cho JavaScript. Thông thường, bạn có thể cần phải bật hoặc tắt hỗ trợ này theo cách thủ công. Chương này giải thích quy trình bật và tắt hỗ trợ JavaScript trong các trình duyệt của bạn: Internet Explorer, Firefox, chrome và Opera.

JavaScript trong Internet Explorer
Dưới đây là các bước đơn giản để bật hoặc tắt JavaScript trong Internet Explorer của bạn -

  • Follow Tools → Internet Options from the menu.

  • Select Security tab from the dialog box.

  • Click the Custom Level button.

  • Scroll down till you find Scripting option.

  • Select Enable radio button under Active scripting.

  • Finally click OK and come out

JavaScript trong Firefox
Dưới đây là các bước để bật hoặc tắt JavaScript trong Firefox -

  • Open a new tab → type about: config in the address bar.

  • Then you will find the warning dialog. Select I’ll be careful, I promise!

  • Then you will find the list of configure options in the browser.

  • In the search bar, type javascript.enabled.

  • There you will find the option to enable or disable javascript by right-clicking on the value of that option → select toggle.

JavaScript trong Chrome
Dưới đây là các bước để bật hoặc tắt JavaScript trong Chrome -

  • Click the Chrome menu at the top right hand corner of your browser.

  • Select Settings.

  • Click Show advanced settings at the end of the page.

  • Under the Privacy section, click the Content settings button.

  • In the "Javascript" section, select "Do not allow any site to run JavaScript" or "Allow all sites to run JavaScript (recommended)".

JavaScript trong Opera
Dưới đây là các bước để bật hoặc tắt JavaScript trong Opera -

  • Follow Tools → Preferences from the menu.

  • Select Advanced option from the dialog box.

  • Select Content from the listed items.

  • Select Enable JavaScript checkbox.

  • Finally click OK and come out.

Cảnh báo cho các trình duyệt không phải JavaScript
Nếu bạn phải làm điều gì đó quan trọng bằng JavaScript, thì bạn có thể hiển thị thông báo cảnh báo cho người dùng bằng cách sử dụng thẻ <noscript>.

Bạn có thể thêm khối noscript ngay sau khối script như sau:

<html>
   <body>
      <script language = "javascript" type = "text/javascript">
         <!--
            document.write("Hello World!")
         //-->
      </script>
      
      <noscript>
         Sorry...JavaScript is needed to go ahead.
      </noscript>      
   </body>
</html>

Bây giờ, nếu trình duyệt của người dùng không hỗ trợ JavaScript hoặc JavaScript không được bật, thì thông báo từ </noscript> sẽ được hiển thị trên màn hình.

 



Đóng góp ý kiến của bạn về bài học để admin liên hệ hoặc giúp nhé


CÔNG TY THIẾT KẾ WEBSITE CHUYÊN NGHIỆP

Kết nối với chúng tôi