Mercurial > hg > LGServices
comparison src/main/webapp/resources/js/general.js @ 77:997601ee0c6e
fix form submit issue above Chrome 56.x edition
author | Calvin Yeh <cyeh@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 03 May 2017 19:51:43 +0200 |
parents | 6ad066ddf3fe |
children | b27a99201cbe |
comparison
equal
deleted
inserted
replaced
76:6ad066ddf3fe | 77:997601ee0c6e |
---|---|
1 function getChromeVersion(){ | |
2 | |
3 var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); | |
4 | |
5 return raw ? parseInt(raw[2], 10) : false; | |
6 } | |
7 | |
1 function branchInExtractionInterface( | 8 function branchInExtractionInterface( |
2 branchId, fileId, | 9 branchId, fileId, |
3 sectionId, | 10 sectionId, |
4 sectionName, | 11 sectionName, |
5 bookId, | 12 bookId, |
50 hiddenField6.setAttribute("value", bookName); | 57 hiddenField6.setAttribute("value", bookName); |
51 form.appendChild(hiddenField6); | 58 form.appendChild(hiddenField6); |
52 | 59 |
53 console.log(navigator.userAgent.toLowerCase()); | 60 console.log(navigator.userAgent.toLowerCase()); |
54 | 61 |
55 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.toLowerCase().indexOf('chrome/56') > -1) { | 62 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || getChromeVersion() > 55) { |
56 document.body.appendChild(form); | 63 document.body.appendChild(form); |
57 form.submit(); | 64 form.submit(); |
58 document.body.removeChild(form); | 65 document.body.removeChild(form); |
59 } else { | 66 } else { |
60 | 67 |
99 var hiddenField7 = document.createElement("input"); | 106 var hiddenField7 = document.createElement("input"); |
100 hiddenField7.setAttribute("name", "topic"); | 107 hiddenField7.setAttribute("name", "topic"); |
101 hiddenField7.setAttribute("value", topicId); | 108 hiddenField7.setAttribute("value", topicId); |
102 form.appendChild(hiddenField7); | 109 form.appendChild(hiddenField7); |
103 | 110 |
104 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.toLowerCase().indexOf('chrome/56') > -1) { | 111 if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || getChromeVersion() > 55) { |
105 document.body.appendChild(form); | 112 document.body.appendChild(form); |
106 form.submit(); | 113 form.submit(); |
107 document.body.removeChild(form); | 114 document.body.removeChild(form); |
108 } else { | 115 } else { |
109 form.submit(); // works under IE, neither FF nor Chrome | 116 form.submit(); // works under IE, neither FF nor Chrome |