LoginSignup
0
0

More than 5 years have passed since last update.

GreasemonkeyのunsafeWindowの移行タイミングのひとつはgrant

Posted at

題意そのまま。

通常、Greasemonkeyが実行元ページのオブジェクト、window.Hogeにアクセスしたい場合、Hogeでアクセスできる。
これは一般的なwindowオブジェクトの省略である。
しかし、GM関数を使う場合(@grant GM_~)は、windowオブジェクトがunsafeWindowオブジェクトへと移動する。
したがって、省略も不可になり、unsafeWindow.Hogeと参照しなければならなくなる。

新機能を追加しようと@grantを書き換えたとき、既存機能が壊れる可能性があるので留意する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0