Skip to content

Commit 672fc9b

Browse files
committed
remove use of localStorage and JSON2 deps in postBridge feature (close #48 #47)
1 parent 9b75370 commit 672fc9b

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

src/window.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* Post data bridge for IE11 popup
4141
* @type {string}
4242
*/
43-
this.postDataBridgeUrl = '';
43+
this.postBridgeUrl = '';
4444
}
4545

4646
/**********
@@ -65,7 +65,7 @@
6565
/**
6666
* Open popup
6767
* Caution:
68-
* In IE11, when transfer data to popup by POST, must set the postDataBridgeUrl.
68+
* In IE11, when transfer data to popup by POST, must set the postBridgeUrl.
6969
*
7070
* @param {string} url - popup url
7171
* @param {Object} options
@@ -83,7 +83,7 @@
8383
* If true, the popup will be reloaded when you try to re-open the popup that has been opened.<br>
8484
* When transmit the POST-data, some browsers alert a message for confirming whether retransmit or not.
8585
*
86-
* @param {string} [options.postDataBridgeUrl=''] - Use this url to avoid a certain bug occuring when transmitting POST data to the popup in IE11.<br>
86+
* @param {string} [options.postBridgeUrl=''] - Use this url to avoid a certain bug occuring when transmitting POST data to the popup in IE11.<br>
8787
* This specific buggy situation is known to happen because IE11 tries to open the requested url not in a new popup window as intended, but in a new tab.<br>
8888
* See {@link http://wiki.nhnent.com/pages/viewpage.action?pageId=240562844}
8989
*
@@ -103,15 +103,15 @@
103103

104104
options.method = options.method.toUpperCase();
105105

106-
this.postDataBridgeUrl = options.postDataBridgeUrl || this.postDataBridgeUrl;
106+
this.postBridgeUrl = options.postBridgeUrl || this.postBridgeUrl;
107107

108108
var popup,
109109
formElement,
110110
useIEPostBridge = options.method === 'POST' && options.param &&
111111
tui.util.browser.msie && tui.util.browser.version === 11;
112112

113113
if (!tui.util.isExisty(url)) {
114-
throw new Error('Popup#open() 팝업 URL이 입력되지 않았습니다');
114+
throw new Error('Popup#open() need popup url.');
115115
}
116116

117117
popup_id += 1;
@@ -155,7 +155,7 @@
155155
this.closeWithParentPopup[options.popupName] = options.closeWithParent;
156156

157157
if (!popup || popup.closed || tui.util.isUndefined(popup.closed)) {
158-
alert('브라우저에 팝업을 막는 기능이 활성화 상태이기 때문에 서비스 이용에 문제가 있을 수 있습니다. 해당 기능을 비활성화 해 주세요');
158+
alert('please enable popup windows for this website');
159159
}
160160

161161
if (options.param && options.method === 'POST' && !useIEPostBridge) {
@@ -298,16 +298,10 @@
298298
var popup;
299299

300300
if (useIEPostBridge) {
301-
url = this.postDataBridgeUrl + '?storageKey=' + encodeURIComponent(popupName) +
302-
'&redirectUrl=' + encodeURIComponent(url);
303-
if (!window.localStorage) {
304-
alert('IE11브라우저의 문제로 인해 이 기능은 브라우저의 LocalStorage 기능을 활성화 하셔야 이용하실 수 있습니다');
305-
} else {
306-
localStorage.removeItem(popupName);
307-
localStorage.setItem(popupName, JSON.stringify(param));
308-
309-
popup = window.open(url, popupName, optionStr);
310-
}
301+
popup = window.open(this.postBridgeUrl, popupName, optionStr);
302+
setTimeout(function() {
303+
popup.redirect(url, param);
304+
}, 100);
311305
} else {
312306
popup = window.open(url, popupName, optionStr);
313307
}
@@ -316,5 +310,4 @@
316310
};
317311

318312
tui.util.popup = new Popup();
319-
320313
})(window.tui);

0 commit comments

Comments
 (0)