summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js50
1 files changed, 28 insertions, 22 deletions
diff --git a/core/js/js.js b/core/js/js.js
index ee841227695..770ce4ea695 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -180,8 +180,32 @@ if (!Array.prototype.indexOf){
* check if the browser support svg images
*/
function SVGSupport() {
- return !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect;
+ return SVGSupport.checkMimeType.correct && !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect;
}
+SVGSupport.checkMimeType=function(){
+ $.ajax({
+ url: OC.imagePath('core','breadcrumb.svg'),
+ success:function(data,text,xhr){
+ var headerParts=xhr.getAllResponseHeaders().split("\n");
+ var headers={};
+ $.each(headerParts,function(i,text){
+ if(text){
+ var parts=text.split(':',2);
+ var value=parts[1].trim();
+ if(value[0]=='"'){
+ value=value.substr(1,value.length-2);
+ }
+ headers[parts[0]]=value;
+ }
+ });
+ if(headers["Content-Type"]!='image/svg+xml'){
+ replaceSVG();
+ SVGSupport.checkMimeType.correct=false
+ }
+ }
+ });
+}
+SVGSupport.checkMimeType.correct=true;
//replace all svg images with png for browser compatibility
function replaceSVG(){
@@ -223,27 +247,9 @@ function object(o) {
$(document).ready(function(){
if(!SVGSupport()){//replace all svg images with png images for browser that dont support svg
replaceSVG();
- };
- $.ajax({
- url: OC.imagePath('core','breadcrumb.svg'),
- success:function(data,text,xhr){
- var headerParts=xhr.getAllResponseHeaders().split("\n");
- var headers={};
- $.each(headerParts,function(i,text){
- if(text){
- var parts=text.split(':',2);
- var value=parts[1].trim();
- if(value[0]=='"'){
- value=value.substr(1,value.length-2);
- }
- headers[parts[0]]=value;
- }
- });
- if(headers["Content-Type"]!='image/svg+xml'){
- replaceSVG();
- }
- }
- });
+ }else{
+ SVGSupport.checkMimeType();
+ }
$('form.searchbox').submit(function(event){
event.preventDefault();
})