Here is a sample code:
HTML
<script> alert('This is alert!') </script>
Js
window.alert = function(data) //alert() over-riding { scriptObject = document.currentScript;
Update: The above code now does not work (it previously worked, compatibility has been removed for IE .) In Internet Explorer 11.420.10586.0. Why can it find a Script object in Chrome, Firefox, Safari, and Microsoft Edge, but not in Internet Explorer? Is there an alternative way?
Question:
HTML
<script> ReferenceError.prototype.__defineGetter__('name', function fff() { javascript:alert(1) }),x </script>
Js
window.alert = function(data) //alert() over-riding { scriptObject = ?
I tried arguments.callee.caller find fff() but couldn't catch the Script object.
Alert () is not executed in Chrome for the above script. Use Firefox instead. I could not get the Script object in any browser.
Any solution please?
source share