summaryrefslogtreecommitdiffstats
path: root/core/js/eventsource.js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-11-16 20:28:03 +0100
committerArthur Schiwon <blizzz@owncloud.com>2012-11-26 14:34:41 +0100
commit4764876192bae91eaba86f3e0ca9f4c7ea8d20be (patch)
treeeb0b4a0bad8b6d94b9aecf10b589d86514ff7fbe /core/js/eventsource.js
parent776be8d9f78e7c10099f068415f153fa69014166 (diff)
downloadnextcloud-server-4764876192bae91eaba86f3e0ca9f4c7ea8d20be.tar.gz
nextcloud-server-4764876192bae91eaba86f3e0ca9f4c7ea8d20be.zip
check whether to join url with ? or &
Diffstat (limited to 'core/js/eventsource.js')
-rw-r--r--core/js/eventsource.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/js/eventsource.js b/core/js/eventsource.js
index 7a744f7a6ce..2bd080fba76 100644
--- a/core/js/eventsource.js
+++ b/core/js/eventsource.js
@@ -42,7 +42,13 @@ OC.EventSource=function(src,data){
}
dataStr+='requesttoken='+OC.EventSource.requesttoken;
if(!this.useFallBack && typeof EventSource !='undefined'){
- this.source=new EventSource(src+'&'+dataStr);
+ var joinChar = '&';
+ if(src.indexOf('?') == -1) {
+ joinChar = '?';
+ }
+ alert(src.indexOf('?'));
+ alert(joinChar);
+ this.source=new EventSource(src+joinChar+dataStr);
this.source.onmessage=function(e){
for(var i=0;i<this.typelessListeners.length;i++){
this.typelessListeners[i](JSON.parse(e.data));
@@ -54,7 +60,12 @@ OC.EventSource=function(src,data){
this.iframe=$('<iframe/>');
this.iframe.attr('id',iframeId);
this.iframe.hide();
- this.iframe.attr('src',src+'&fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
+
+ var joinChar = '&';
+ if(src.indexOf('?') == -1) {
+ joinChar = '?';
+ }
+ alert(src.indexOf('?')); this.iframe.attr('src',src+joinChar+'fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
$('body').append(this.iframe);
this.useFallBack=true;
OC.EventSource.iframeCount++