Page 1 of 1

Javascript / AJAX Access to status.xml

Posted: 22 Oct 2013 23:06
by blck
Hi,
I'm developing a remote controll app (based on HTML / Javascript) for the vlc. It was working fine, until I updated to 2.1.0, which now requires a password. It's a very good thing, but I have no clue how to pass that password via Javascript-Ajax-call. I'm using jQuery to help me.

I would be grateful for any help. I saw https://forum.videolan.org/viewtopic.php?f=16&t=114601, but that's PHP and I'm not entirely sure how to transfer that to Javascript.

Thank you in advanced,
blck

Re: Javascript / AJAX Access to status.xml

Posted: 24 Oct 2013 22:56
by blck
Hey,
I figured it our. Here is a code snipplet, that worked for me:

Code: Select all

checkConnection = function(id, folder){ //test user settings $.ajax({ url: 'http://' + data.ip + ":" + data.port + '/requests/status.xml', beforeSend : function(xhr) { if(data.authorization !== undefined){ xhr.setRequestHeader("Authorization", "Basic " + "username:password"); //you can leave the username out, so that it looks like that: ":password" //you need the : though and the combination needs to be Base64 encoded } }, success: function (data, status, jqXHR) { }, error: function(data){ } }); };

Re: Javascript / AJAX Access to status.xml

Posted: 24 Feb 2014 15:41
by oakley
Hi,

i am using Version 2.1.3 and tried:

Code: Select all

checkConnection = function(){ //test user settings $.ajax({ url: 'http://192.168.100.188:8080/requests/status.xml', data:''; beforeSend : function(xhr) { if(data.authorization !== undefined){ xhr.setRequestHeader("Authentication", "Basic " + btok(":test1234")); //My Pass for Testing is test1234 } }, success: function (data, status, jqXHR) { alert('success'); }, error: function(data){ console.log(data); } }); };
The Error I get is: SCRIPT7002: XMLHttpRequest: Networkerror 0x80070005, Access denied

Can anyone please help me out?

Best regards....

Mirko