をリロード私はJavascriptを持っているページの後のonclickイベントスティックを行います別のウィンドウを開き、すべてのリンクのクリックハンドラを登録することが
//Inside a class somewhere
this.file_browser_window = $(window.open("/filebrowser", "file_browser_window",
"width=800,height=600"))
Event.observe(this.file_browser_window, 'load', function(){
//This is the event I am after
Event.observe(this.file_browser_window, 'click', handle_click_in_browser);
}.bindAsEventListener(this));
// The Handler function
function handle_click_in_browser(evt){
evt.stop();
url = evt.target.href;
if(url && url.endsWith('.png')){
console.log("Image clicked");
//REMMEMBER THIS URL ON MAIN PAGE
this.close();
}
else{
console.log("Regular stuff clicked", this);
this.location = url; //<-- THIS is the breaking point
}
}
ただし、ユーザーがそのポップアップウィンドウにいくつかのリンクをクリックしたときに、ときページの再読み込み、私のクリックハンドラーがなくなった!
ポップアップウィンドウ内のリンクは、同じドメインを指します。
今、は、ポップアップウィンドウのソース(html)を変更できません。 をキャッチユーザがクリックしたリンクタグのhref(画像を指す場合)。
興味があれば、私はdjango-filebrowserをポップアップウィンドウで実行しています。
ポップアップウィンドウのリンク先を同じドメイン内のページ? – SLaks
彼らは確かにそうです – drozzy