Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- http://stackoverflow.com/questions/18342200/how-do-i-call-eval-in-ie-from-c/ -->
- <head>
- <script>
- function Test()
- {
- var ie = new ActiveXObject("InternetExplorer.Application");
- ie.Visible = true;
- ie.Navigate("http://jsfiddle.net/");
- WhenLoaded(ie, function() {
- // injector code
- var __execScript = "window.__execScript = function(exp) { return eval(exp); }";
- // inject into main window
- ie.Document.parentWindow.eval(__execScript);
- ie.Document.parentWindow.__execScript("alert(document.URL)");
- // inject into a child frame - from the context of the main window
- ie.Document.parentWindow.__execScript('document.all.tags("iframe")[0].contentWindow.eval("' + __execScript + '")');
- ie.Document.parentWindow.document.all.tags("iframe")[0].contentWindow.__execScript("alert(document.URL)");
- });
- }
- function WhenLoaded(ie, loaded)
- {
- if (ie.readyState === 4)
- loaded();
- else
- setTimeout(function() { WhenLoaded(ie, loaded); }, 250);
- }
- </script>
- </head>
- <body>
- <button onclick="Test()">Test</button>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement