diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..849ddff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+dist/
diff --git a/src/jquery.address.js b/src/jquery.address.js
index b423e34..688463a 100644
--- a/src/jquery.address.js
+++ b/src/jquery.address.js
@@ -61,7 +61,8 @@
},
_window = function() {
try {
- return top.document !== UNDEFINED && top.document.title !== UNDEFINED ? top : window;
+ return top.document !== UNDEFINED && top.document.title !== UNDEFINED && top.jQuery !== UNDEFINED &&
+ top.jQuery.address !== UNDEFINED && top.jQuery.address.frames() !== false ? top : window;
} catch (e) {
return window;
}
@@ -337,6 +338,7 @@
crawlable: FALSE,
history: TRUE,
strict: TRUE,
+ frames: TRUE,
wrap: FALSE
},
_browser = $.browser,
@@ -466,6 +468,14 @@
}
return _opts.state;
},
+ frames: function(value) {
+ if (value !== UNDEFINED) {
+ _opts.frames = value;
+ _t = _window();
+ return this;
+ }
+ return _opts.frames;
+ },
strict: function(value) {
if (value !== UNDEFINED) {
_opts.strict = value;
diff --git a/test/frame.html b/test/frame.html
new file mode 100644
index 0000000..b4fcbfb
--- /dev/null
+++ b/test/frame.html
@@ -0,0 +1,11 @@
+
+
+
+ jQuery Address Test Suite
+
+
+
+
+
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
index 81cb100..e02b91d 100644
--- a/test/test.js
+++ b/test/test.js
@@ -61,6 +61,54 @@ asyncTest('Query test', function() {
}, 100);
});
+asyncTest('Frames disabled test', function() {
+ setTimeout(function() {
+ $.address.parameter('p', 2);
+
+ var $iframe = $('');
+
+ window.iframe = function(val){
+ equals(val, 1);
+
+ delete window.iframe;
+
+ window.history.back();
+
+ start();
+
+ $iframe.remove();
+ }
+
+ $.address.frames(false);
+
+ $iframe.appendTo('body');
+ }, 100);
+});
+
+asyncTest('Frames enabled test', function() {
+ setTimeout(function() {
+ $.address.parameter('p', 3);
+
+ var $iframe = $('');
+
+ window.iframe = function(val){
+ equals(val, 3);
+
+ delete window.iframe;
+
+ window.history.back();
+
+ start();
+
+ $iframe.remove();
+ }
+
+ $.address.frames(true);
+
+ $iframe.appendTo('body');
+ }, 100);
+});
+
asyncTest('Parameter test', function() {
setTimeout(function() {
$.address.parameter('a', null);
@@ -414,7 +462,6 @@ asyncTest('ensure code in hash is not executed (see commit a9f95e5885a9e)', func
})
-
setTimeout(function() {
$.address.value('/');
}, 30000);