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:
XML
<script type="text/javascript">
   function checkconnection() {
   var status = navigator.onLine;
   if (status) {
   <script src="https://www.google.com/jsapi"></script>
   } else {
   <script src="Script/barchat.js"></script>
   }
   }
   </script>


If internet connection status is true means we call "https://www.google.com/jsapi" .
If connection status is false we call "barchat.js".

This script is correct or not..

Please Help me
Posted

1 solution

No, you can't embed html tags in javascript this way. But you can load script programatically with jquery for example: http://api.jquery.com/jquery.getscript/[^].
 
Share this answer
 
Comments
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