Module: check_mk
Branch: master
Commit: 2661bd540a23b245955868451276fa920d487daa
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2661bd540a23b2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 5 11:19:01 2011 +0100
Catching more cross domain javascript errors
---
web/htdocs/js/sidebar.js | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js
index d132fd6..66a8b6f 100644
--- a/web/htdocs/js/sidebar.js
+++ b/web/htdocs/js/sidebar.js
@@ -26,7 +26,9 @@ var browser = navigator.userAgent.toLowerCase();
var weAreIEF__k = ((browser.indexOf("msie") != -1) &&
(browser.indexOf("opera") == -1));
var weAreOpera = browser.indexOf("opera") != -1;
var weAreFirefox = browser.indexOf("firefox") != -1 ||
browser.indexOf("namoroka") != -1;
-var contentLocation = parent.frames[1].document.location;
+var contentLocation = null;
+if(contentFrameAccessible())
+ var contentLocation = parent.frames[1].document.location;
//
// Sidebar styling and scrolling stuff
@@ -357,6 +359,18 @@ function getSnapinTargetPos() {
* misc sidebar stuff
*************************************************/
+// Checks if the sidebar can access the content frame. It might be denied
+// by the browser since it blocks cross domain access.
+function contentFrameAccessible() {
+ try {
+ var d = parent.frames[1].document;
+ d = null;
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
function debug(s) {
window.parent.frames[1].document.write(s+'<br />');
}
@@ -654,18 +668,6 @@ function sidebar_scheduler() {
setTimeout(function(){sidebar_scheduler();}, 1000);
}
-// Checks if the sidebar can access the content frame. It might be denied
-// by the browser since it blocks cross domain access.
-function contentFrameAccessible() {
- try {
- var d = parent.frames[1].document;
- d = null;
- return true;
- } catch (e) {
- return false;
- }
-}
-
function addBookmark() {
href = parent.frames[1].location;
title = parent.frames[1].document.title;