I have a link with some javascript inside it.

HTML Code:
<a href="javascript:void(document.location='http://website.com/?yrl='+document.location)">
I need to encode the document location in BAse64, can this be done using javascript?