15 October 2013

URL Coder/Encoder

Hi All,

Let see how can we use coding / encoding url.

  • Paste the encoded text and click decode button to DECODE.
  • Paste the decoded text and click encode button to ENCODE

URL Decoder/Encoder



Lets see how can we write our own URL encoder decoder.
  • Open notepad.
  • Paste the following contents.

<html>
<head>
   <title>MyTacTics.blogspot.in</title>
   <script type="text/javascript">
      function encode() {
         var obj = document.getElementById('dencoder');
         var unencoded = obj.value;
         obj.value = encodeURIComponent(unencoded).replace(/'/g,"%27").replace(/"/g,"%22");   
      }
      function decode() {
         var obj = document.getElementById('dencoder');
         var encoded = obj.value;
         obj.value = decodeURIComponent(encoded.replace(/\+/g,  " "));
      }
   </script>
</head>
<body>
   <form onsubmit="return false">
   <h1>
   URL Decoder/Encoder</h1>
   <textarea cols="80" id="dencoder" rows="20" style="resize: none;"></textarea>
   <div>
      <input onclick="decode()" type="button" value="Decode" />
      <input onclick="encode()" type="button" value="Encode" />
   </div>
   </form>
</body>


  • Save the file as URL.html, and its done.

Happy Knowledge sharing.. :)

No comments:

Post a Comment