views:

32

answers:

0

Hi I am making a chrome extension. Where I save a page to the database as a string and then open it later as a dataURI scheme like:

d = 'data:text/html;charset=utf-8'+encodeURI('HTML TEXT')
location.reload(d);

The problem with this is that the page, say its name is http://X/, in which I executed the above command loses the javascript files in its head. I considered using the document.write(d), if d has a string appeneded to it with the <head>...</head> of http://X/.

But this opens a big vulnerability problem for XSS. At this point I am trying to think of white listing tags when I save the original page... is there another way?