check whether to join url with ? or &
This commit is contained in:
parent
776be8d9f7
commit
4764876192
1 changed files with 13 additions and 2 deletions
|
@ -42,7 +42,13 @@ OC.EventSource=function(src,data){
|
||||||
}
|
}
|
||||||
dataStr+='requesttoken='+OC.EventSource.requesttoken;
|
dataStr+='requesttoken='+OC.EventSource.requesttoken;
|
||||||
if(!this.useFallBack && typeof EventSource !='undefined'){
|
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){
|
this.source.onmessage=function(e){
|
||||||
for(var i=0;i<this.typelessListeners.length;i++){
|
for(var i=0;i<this.typelessListeners.length;i++){
|
||||||
this.typelessListeners[i](JSON.parse(e.data));
|
this.typelessListeners[i](JSON.parse(e.data));
|
||||||
|
@ -54,7 +60,12 @@ OC.EventSource=function(src,data){
|
||||||
this.iframe=$('<iframe/>');
|
this.iframe=$('<iframe/>');
|
||||||
this.iframe.attr('id',iframeId);
|
this.iframe.attr('id',iframeId);
|
||||||
this.iframe.hide();
|
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);
|
$('body').append(this.iframe);
|
||||||
this.useFallBack=true;
|
this.useFallBack=true;
|
||||||
OC.EventSource.iframeCount++
|
OC.EventSource.iframeCount++
|
||||||
|
|
Loading…
Reference in a new issue