From f99752cb955e353875fb3948a47bf2d506e1d86a Mon Sep 17 00:00:00 2001 From: Benjamin Zaporzan Date: Wed, 1 Oct 2014 14:47:06 -0400 Subject: [PATCH] fixed bug with clicking window.open --- project.clj | 2 +- src-cljs/flyer/storage.cljs | 4 ++++ src-cljs/flyer/window.cljs | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/project.clj b/project.clj index ea547da..51c94bd 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject flyer "1.0.1" +(defproject flyer "1.0.2" :description "Clojurescript + Javascript Broadcast Messaging between iFrames, Framesets, and Windows" :url "https://github.com/benzap/flyer.js" diff --git a/src-cljs/flyer/storage.cljs b/src-cljs/flyer/storage.cljs index 055820b..75d4ee9 100644 --- a/src-cljs/flyer/storage.cljs +++ b/src-cljs/flyer/storage.cljs @@ -10,6 +10,10 @@ (defn get-window-refs [] (aget storage window-list-key)) +(defn has-window-ref? [window] + (let [winref (get-window-refs)] + (some #{window} winref))) + (defn insert-window-ref! [window] (aset storage window-list-key (conj (get-window-refs) window))) diff --git a/src-cljs/flyer/window.cljs b/src-cljs/flyer/window.cljs index 4269ed3..cf8e811 100644 --- a/src-cljs/flyer/window.cljs +++ b/src-cljs/flyer/window.cljs @@ -34,7 +34,10 @@ external windows that are opened using the 'open' function" :else (apply gen-window-options options)) window (.open this-window url name options-str)] - (storage/insert-window-ref! window) + ;;only add the window to our window references if it didn't exist previously + ;;fixes issue with IE when trying to re-open a window + (when (not (storage/has-window-ref? window)) + (storage/insert-window-ref! window)) (events/listen window (.-BEFOREUNLOAD events/EventType) (fn [event]