Today, I encountered a very interesting question in the group. There are a wide variety of answers that everyone can give. Specially organized into blog posts:
// Original question: window. alert = function () {}; ______; alert (1); fill in the blanks to make the following alert (1) pop up correctly. At least two different ideas are listed.
Solution 1: Create a new execution environment and use the IFRAME sandbox
Window. alert = function () {}; window. alert = function (OBJ) {var IFRAME = document. createelement ("iframe"); IFRAME. src = "javascript: void (0);" document. body. appendchild (IFRAME) IFRAME. contentWindow. alert (OBJ);} alert (1)
Solution 2: Create a new execution environment and open a new window
Window. alert = function () {}; window. alert = function (a) {window. open ('',''). alert (a) // zookeeper createpopup().doc ument. parentwindow. alert (a) // ie only} alert (1 );
Solution 3: Get back the original Alert (ie failed)
Window. Alert = function () {}; window. Alert = function (a) {Delete window. Alert; window. Alert (a) ;}alert (1 );
Solution 4: Same Idea 3 (ie failure)
Window. alert = function () {}; window. alert = function (a) {window. _ PROTO __. alert. call (window, a); // window. constructor. prototype. alert. call (window, a);} alert (1 );
Solution 5 (ie Only)
Window. Alert = function () {}; execScript ('sub alert (MSG): msgbox MSG: End sub ', 'vbscript'); alert (1 );
Solution 6 is just a dizzy trick.
Window. Alert = function () {}; window. Alert = function (a) {window. Confirm (a)} alert (1 );