Bookmark and Share

Wednesday, May 18, 2011

Javascript HTML encoding/decoding utility

Today I found a great script for encoding and decoding HTML on the browser:

http://www.strictly-software.com/htmlencode

The library is located under http://www.strictly-software.com/scripts/downloads/encoder.js

The usage is really easy:

Encoder.EncodeType = "entity";

var encoded = Encoder.htmlEncode(document.getElementById('input'))

var decoded = Encoder.htmlDecode(encoded);


That’s all!

2 comments:

  1. still got error : when i put it on hosted services

    ReplyDelete
  2. Hello WillyKk... what kind of error do you receive?
    The code is executed on the browser.. so I think that the problem is based on http 404 error or on cache version of the file.
    Try to trace the http stream using fiddler or firefox, I think you will find the solution.

    ReplyDelete