-3

mshtml を使用して IE 拡張機能を作成しています。ユーザーに表示された最近のアラートからテキストを取得する方法はありますか (C# または JavaScript 経由)?

前もって感謝します。

4

1 に答える 1

0

Web サイトの任意の JS をハイジャック/挿入/実行できる場合は、alert メソッドをカスタム メソッドで上書きするだけで、内部の元のメソッドを呼び出すことができます :) 次のようなもの:

// let's save the alert first
var _super_original_alert = window.alert;
// and now we overwrite it
window.alert = function(s){
  // do something with the received string
  // i will just log it, but you might want to send the string via
  // ajax/jsonp to a remote server
  console.log(s)

  // call the original intended alert
  _super_original_alert(s)
}

それは良くありませんが、トリックを行うことができます.

于 2012-09-14T13:50:05.753 に答える