Hi,

I try to connect on Youtube using the script below.
But I get the error message:

Access to restricted URI denied" code: "1012

Is there any way to bypass this issue ?

function login() {
        var u = 'xyz';
        var p = 'xyz';
        $.ajax({
                type: 'POST',
                dataType:'json',
                url: 
'https://www.google.com/accounts/ServiceLoginAuth?service=youtube',
                beforeSend: function(r) {
                        r.setRequestHeader('Content-type', 
'application/x-www-form-urlencoded');
                        r.setRequestHeader('Accept',
'application/atom+xml,application/xml,text/xml,text/html');
                },
                data:
encodeURI('service=youtube&uilel=3&ltmpl=sso&hl=en_US&Email='+u+'&Passwd='+p),
                success: function(r) {
                        alert(r.responseText);
                        if(r.responseText.indexOf('The username or password you 
entered is
incorrect')!=-1) {
                                alert('Invalid username or password.');
                                var user = 
prompt('Username:').replace(/[^A-Za-z0-9-_]+/, ''),
                                pass = 
prompt('Password:').replace(/[^A-Za-z0-9-_]+/, '');
                                if(user && pass && user!='' && pass!='') 
login(user, pass);
                        }
                        else if(r.responseText.indexOf('Sign Out')!=-1) 
alert('You are now logged
into YouTube');
                }
        });
}

Thank you for any help.
.
-- 
View this message in context: 
http://www.nabble.com/Connecting-on-YouTube-using-%24.ajax---tp23471637s27240p23471637.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to