I think this is best done serverside but if you really want to do it on client, have look at JSTS https://www.ohloh.net/p/jsts Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.