Hi guys,
How to attach this base64 encoded script to a div and execute.
var a = 'Y29uc29sZS5sb2coJ2FiY2RlZmdoaWxtbmprJyk=';
var c = document,
d = c.getElementById('myDiv'),
e = c.createElement('script');
e.src = 'data:text/javascript;base64,' + a;
d.appendChild(e);
I’ve tried and it failed.
Thank you,
ralphm
March 31, 2015, 4:08am
2
What browser were you using? I seems to work in Chrome.
Hi,
Thank you. I use Chrome and get this error:
GET data:text/javascript;base64,console.log('abcdefghilmnjk') net::ERR_INVALID_URL
ralphm
March 31, 2015, 7:16am
4
Hm, on Chrome for Mac it works. Are you placing the script just before the closing body
tag?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="myDiv"></div>
<script>
var a = 'Y29uc29sZS5sb2coJ2FiY2RlZmdoaWxtbmprJyk=';
var c = document,
d = c.getElementById('myDiv'),
e = c.createElement('script');
e.src = 'data:text/javascript;base64,' + a;
d.appendChild(e);
</script>
</body>
</html>
system
Closed
June 30, 2015, 2:22pm
5
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.