title: URL check in JQuery Mobile
body: <p>I am making a browser app for mobiles that takes URL and browse through it and it is working correctly. Now I want to perform a check on the text entered by the user before performing any action. </p>
  
  <p><strong>First priority</strong>: The URL check, whether it is in correct form or not.</p>
  
  <p><strong>Second Priority</strong>: If it is not a URL then it should go for a google search with the same keywords.</p>
  
  <p>I did a validation on URL whether it is null or blank. But I want to perform above tasks that if it is not a URL, I will redirect it to Google search.</p>
  
  <p>Can anyone help how to check the URL with JQuery Mobile? </p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt;
  
      document.addEventListener('deviceready',onDeviceReady, false);
  
      function onDeviceReady() {
          navigator.notification.prompt(
              'Please enter the URL you want to browse', //massage
              onPrompt,   // callback to invoke
              'URL',      // title
              ['Ok','Exit']   //buttonLabels
          );
      }
  
      var ref=null;
  
      function onPrompt(results){
          if(results.input1==""||results.input1==null)
              onDeviceReady();
          else
              ref = window.open('http://'+results.input1, '_blank', 'location=yes');
  
          ref.addEventListener('loadstart', iLoadStart);
          ref.addEventListener('loadstop', iLoadStop);
          ref.addEventListener('loaderror', iLoadError);
          ref.addEventListener('exit', iLoadClose);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks! :)</p>