diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-09-10 16:53:16 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-09-10 16:53:16 +0300 |
commit | 1cba602949890ec3e6a60c4197bfa9801ec74323 (patch) | |
tree | df0fa4dab8386303ea9376b0e5596c778af6fe2e /plugins/CoreHome/javascripts/broadcast.js | |
parent | cb1c8f109c82d99968301ed2a1de5e99c50b2f9f (diff) |
fix invalid token error after installation on IE8 and fix JS error re JSON in IE8
Diffstat (limited to 'plugins/CoreHome/javascripts/broadcast.js')
-rw-r--r-- | plugins/CoreHome/javascripts/broadcast.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/CoreHome/javascripts/broadcast.js b/plugins/CoreHome/javascripts/broadcast.js index de34b45a90..4b6ca7e997 100644 --- a/plugins/CoreHome/javascripts/broadcast.js +++ b/plugins/CoreHome/javascripts/broadcast.js @@ -442,7 +442,24 @@ var broadcast = { urlAjax = urlAjax.match(/^\?/) ? urlAjax : "?" + urlAjax; broadcast.lastUrlRequested = urlAjax; - function sectionLoaded(content) { + + function sectionLoaded(content, status, request) { + if (request) { + var responseHeader = request.getResponseHeader('Content-Type'); + if (responseHeader && 0 <= responseHeader.toLowerCase().indexOf('json')) { + var message = 'JSON cannot be displayed for'; + if (this.getParams && this.getParams['module']) { + message += ' module=' + this.getParams['module']; + } + if (this.getParams && this.getParams['action']) { + message += ' action=' + this.getParams['action']; + } + $('#content').text(message); + piwikHelper.hideAjaxLoading(); + return; + } + } + // if content is whole HTML document, do not show it, otherwise recursive page load could occur var htmlDocType = '<!DOCTYPE'; if (content.substring(0, htmlDocType.length) == htmlDocType) { @@ -468,6 +485,9 @@ var broadcast = { var ajax = new ajaxHelper(); ajax.setUrl(urlAjax); + ajax._getDefaultPostParams = function () { + return {}; + }; ajax.setErrorCallback(broadcast.customAjaxHandleError); ajax.setCallback(sectionLoaded); ajax.setFormat('html'); |