Skip to content

Commit 081b840

Browse files
author
zhourenjian
committed
Support XSS Cookie for modern IE ( >= 6.0 )
1 parent 15f61a2 commit 081b840

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

sources/net.sf.j2s.ajax/store/net/sf/j2s/store/SimpleStore.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ private SimpleStore() {
1515
/**
1616
* @j2sNative
1717
* var ua = navigator.userAgent.toLowerCase ();
18-
* var isIE = (ua.indexOf ("msie") != -1);
18+
* var isOldIE = ua.indexOf ("msie 5.5") != -1 || ua.indexOf ("msie 5.0") != -1;
1919
* var cookieURL = window["j2s.xss.cookie.url"];
20-
* var isLocal = window.location.protocol == "file:";
21-
* if (!isLocal && cookieURL != null && !isIE) {
20+
* var isLocal = window.location.protocol == "file:"
21+
* || window.location.host.toLowerCase ().indexOf ("localhost") != -1;
22+
* if (!isLocal && cookieURL != null && !isOldIE) {
2223
* this.store = new net.sf.j2s.store.XSSCookieStore(cookieURL);
2324
* } else {
2425
* this.store = new net.sf.j2s.store.CookieStore();

sources/net.sf.j2s.ajax/store/net/sf/j2s/store/XSSCookieStore.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
*
99
* @j2sSuffix
1010
* var ua = navigator.userAgent.toLowerCase ();
11-
* var isIE = (ua.indexOf ("msie") != -1);
11+
* var isOldIE = ua.indexOf ("msie 5.5") != -1 || ua.indexOf ("msie 5.0") != -1;
1212
* var xssCookieURL = window["j2s.xss.cookie.url"];
13-
* var isLocal = window.location.protocol == "file:";
14-
* if (!isLocal && xssCookieURL != null && !isIE) {
13+
* var isLocal = window.location.protocol == "file:"
14+
* || window.location.host.toLowerCase ().indexOf ("localhost") != -1;
15+
* if (!isLocal && xssCookieURL != null && !isOldIE) {
1516
* net.sf.j2s.store.XSSCookieStore.initialize(xssCookieURL);
1617
* }
1718
*/
@@ -32,10 +33,7 @@ public XSSCookieStore(String url) {
3233
/**
3334
* @j2sNative
3435
var ua = navigator.userAgent.toLowerCase ();
35-
var isIE = (ua.indexOf ("msie") != -1);
36-
if (!isIE) {
37-
document.domain = document.domain;
38-
}
36+
document.domain = document.domain;
3937
var xssIfr = document.getElementById ("xss-cookie");
4038
if (xssIfr != null) {
4139
return;

0 commit comments

Comments
 (0)