Click here to Skip to main content
15,921,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<script type="text/javascript">
   function checkconnection() {
   var status = navigator.onLine;
   if (status) {
   <script src=""></script>
   } else {
   <script src="Script/barchat.js"></script>

If internet connection status is true means we call "" .
If connection status is false we call "barchat.js".

This script is correct or not..

Please Help me

1 solution

No, you can't embed html tags in javascript this way. But you can load script programatically with jquery for example:[^].
Share this answer
Rnshanmugavadivel 26-Feb-15 7:37am    
Thank you.. can you please explain or write a sample code for above script in your way?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900