Sylera Part9
at SOFTWARE
909:名無しさん@お腹いっぱい。
08/07/11 07:22:52 PiTaZR3I0
>>887 に関連して、DocShellとかWebNavigationとか、知ってる人には当たり前でも
知らん人は全然知らんと思うので、サンプル貼っとく
// ・window.open()の代替関数、個別セキュリティ引継ぎ+リファラ渡し版
// ・引数はURI、レイヤとビューのindex、開いたレイヤ・ビューをそれぞれアクティブにするか(true/falseとか1/0とか適当に)
// ・戻り値はviewIndexではなくWindow Objectにしてあるので注意
function openSyleraView(uri,layerIndex,viewIndex,layerActive,viewActive){
var syleraAPI=Components.classes['@mozilla.org/sylera-api;1'].getService(Components.interfaces.nsISyleraAPI);
var newViewIndex=syleraAPI.insertView('',syleraAPI.gecko,layerIndex,viewIndex);
var newWin=syleraAPI.getDOMWindow(layerIndex,newViewIndex);
var newWinWebNavigation=getWebNavigation(newWin);
var newWinDocShell=getDocShell(newWin);
var docShell=getDocShell(window);
var refUriObj=Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService).newURI(document.URL,null,null);
newWinDocShell.allowJavascript=docShell.allowJavascript;
newWinDocShell.allowImages=docShell.allowImages;
newWinDocShell.allowPlugins=docShell.allowPlugins;
newWinDocShell.allowSubframes=docShell.allowSubframes;
newWinWebNavigation.loadURI(uri,0,refUriObj,null,null);
if(layerActive)syleraAPI.selectLayer(layerIndex);
if(viewActive)syleraAPI.selectView(layerIndex,newViewIndex);
return newWin;
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5378日前に更新/215 KB
担当:undef