Javascript / AJAX Access to status.xml

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
blck
New Cone
New Cone
Posts: 3
Joined: 29 Sep 2013 18:55

Javascript / AJAX Access to status.xml

Postby blck » 22 Oct 2013 23:06

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

blck
New Cone
New Cone
Posts: 3
Joined: 29 Sep 2013 18:55

Re: Javascript / AJAX Access to status.xml

Postby blck » 24 Oct 2013 22:56

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){ } }); };

oakley
New Cone
New Cone
Posts: 5
Joined: 17 Jul 2013 20:40

Re: Javascript / AJAX Access to status.xml

Postby oakley » 24 Feb 2014 15:41

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


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 20 guests