This is my logout script for linked in account. But its logged out only my site login details not logged out opened linkedin account. Can you anybody find my issue?
<button onclick="javascript:onLoad();">Logout In LinkedIn</button>
Script:
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: mykey
authorize: true
onLoad: onLoad
</script>
<script type="text/javascript">
function onLoad() {
try {
IN.User.logout();
} catch (err) {
console.log(err);
}
setTimeout("goToHome()", 100);
}
function goToHome() {
document.location.href = "https://www.linkedin.com/secure/login?session_full_logout=&trk=hb_signout";
location.href="logout";
}
</script>
Related
I am now trying to use javascripts in my project.Can somebody please explain how exactly, can we make javascripts working on a Laravel project ?
all the code works except for the js party
it does not appear on the screen
Thanks
Here's my code :
checkout.blade.php
#extends('layouts.default')
#section('content')
//code
#endsection
#section('extra-js')
<script src="https://js.braintreegateway.com/web/dropin/1.13.0/js/dropin.min.js"></script>
<script>
(function(){
var form = document.querySelector('#paypal-payment-form');
var client_token = "{{ $paypalToken }}";
braintree.dropin.create({
authorization: client_token,
selector: '#bt-dropin',
paypal: {
flow: 'vault'
}
}, function (createErr, instance) {
if (createErr) {
console.log('Create Error', createErr);
return;
}
// remove credit card option
var elem = document.querySelector('.braintree-option__card');
elem.parentNode.removeChild(elem);
form.addEventListener('submit', function (event) {
event.preventDefault();
instance.requestPaymentMethod(function (err, payload) {
if (err) {
console.log('Request Payment Method Error', err);
return;
}
// Add the nonce to the form and submit
document.querySelector('#nonce').value = payload.nonce;
form.submit();
});
});
});
})();
</script>
#endsection
and this is a part of my default.blade.php
default.blade.php
#yield('content')
#yield('extra-js')
<script src="{{ asset('js/app.js') }}"></script>
I am trying to implement login with linked in my web app. Here is my code..
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 'key here'
</script>
</head>
<body>
<script>
IN.User.authorize(function (e) {
console.log(e);
}, function (e) {
console.log(e);
});
</script>
</body>
But its giving me error 'Cannot read property 'then' of undefined at Object.authorize (in.js:18)'
i have also tried this way..
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: 'key here'
onLoad: 'onLinkedInLoad'
authorize: true
</script>
</head>
<body>
<!-- LinkedIn signin button -->
<script type="in/Login"></script>
<script type="text/javascript">
// Setup an event listener to make an API call once auth is complete
function onLinkedInLoad() {
IN.Event.on(IN, "auth", getProfileData);
}
</script>
</body>
but its giving me errror
'in.js:7 Uncaught (in promise) TypeError: Could not instantiate tag for 'login': Cannot read property 'on' of null
at new (Login.js?version=0.1.149:7)
at in.js:18'
The documentation and examples for linkedIn show api_key and onLoad function not being set as a string delimeter.
api_key: 0192afsdj10
onLoad: onLinkedInLoad
Secondly, you have not added in a function for the getProfileData function.
Here is an example of the should look like.
function getProfileData() {
IN.API.Profile("me").fields("id", "first-name", "last-name", "headline", "location", "picture-url", "public-profile-url", "email-address").result(displayProfileData);
}
function displayProfileData(profiles){
var member = profiles.values[0];
console.log(member);
}
See code referenced here
I tried using emailjs browserbox to connect to an imap server but the sample script with the correct port and host and username and password just throws out errors and doesn't work in a client-side html file?
https://github.com/whiteout-io/browserbox is a link to the api. What's wrong with how I wrote the code?
<html>
<head>
<title>Test</title>
<!-- Required for non-Unicode encodings -->
<script src="encoding-indexes.js"></script>
<script src="encoding.js"></script>
<script src="stringencoding.min.js"></script>
<script src="browserbox.js"></script>
<script src="browserbox-imap.js"></script>
<script> var client = new BrowserBox('host', port, {
auth: {
user: 'testuser',
pass: 'testpass'
},
id: {
name: 'My Client',
version: '0.1'
} });
</script>
</head>
<body>
</body>
</html>
I want to connect to Dropbox using Javascript. This is part of a lab that I'm doing.
I have the code below, and I have checked it for syntax errors and haven't found any. However, it doesn't display the buttons I expected.
Here is a JSFiddle demonstrating the code as it is now: https://jsfiddle.net/gv19a3mw/15/
And here is a Fiddle showing the layout I expected (with no Javascript executing): https://jsfiddle.net/gv19a3mw/12/
Can anyone advise me why the buttons are not displaying when my Javascript is executing?
<html>
<head>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="https://www.dropbox.com/static/api/dropbox-datastores-1.2-latest.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#w_area').hide();
$('#r_area').hide();
// Create a dropbox client
var client = new Dropbox.client({key: "pbio1kig5q73lli"});
// Authenticate the client
client.authenticate({interactive: false}, function(error, client) {
if (error) {
alert("Authentication error: " + error);
}
});
// Show w_area if login ok
// alert(client.isAuthenticated());
if (client.isAuthenticated()) {
$('#w_area').show();
};
// Write to myfile.txt in Dropbox
$('#w_button').click(function() {
client.authenticate({interactive: true}, function(error, client) {
if (error) {
alert("Authentication error: " + error);
}
else {
client.writeFile("myfile.txt", $('textarea#w_content').val(), function(error) {
if (error) {
alert("Write error: " + error);
}
else {
alert("File written successfully!");
$('#r_area').show();
}
});
}
});
});
// Read from myfile.txt from Dropbox
$('#r_button').click(function() {
client.authenticate({interactive: true}, function(error, client) {
if (error) {
alert("Authentication error: " + error);
}
else {
client.readFile("myfile.txt", {}, function(error, data) {
if (error) {
alert("Read error: " + error);
}
else {
alert("File read successfully!");
$('textarea#r_content').val(data);
}
});
}
});
});
})
</script>
</script>
</head>
<body>
<h3>File Read/Write in Dropbox</h3>
<div id="w_area">
<textarea id="w_content" cols="50" rows="5">
</textarea>
<button id="w_button">
Write to File in Dropbox
</button>
<br /><br />
</div>
<div id="r_area">
<textarea id="r_content" cols="50" rows="5">
</textarea>
<button id="r_button">
Read from File in Dropbox
</button>
<br /><br />
</div>
</body>
</html>
Remove buttons from element div#w_area and div#r_area
$(document).ready(function() {
$('#w_area').hide();
$('#r_area').hide();
Because of this code your buttons are nor visible.
<script src="http://vkontakte.ru/js/api/openapi.js" type="text/javascript">
</script>
<div id="login_button" onclick="VK.Auth.login(getit);"></div>
<script language="javascript">
VK.init({
apiId: 2903251
});
function getit(response) {
if (response.session) {
var id = response.session.mid;
}
VK.Api.call('users.get', {uids: id, fields: 'sex,photo_big'}, function(r) {
if(r.response) {
alert(r.response.sex);
console.log(r.response);
}
});
}
VK.UI.button('login_button');
</script>
Why does alert(r.response.sex) display undefined, but everything is OK with console logs?
Solved. The solution:
r.response[0].sex