signin with Linkedin code give me html validation error - javascript

I'm using https://validator.w3.org to validate my HTML 5 website. I'm using Linkedin javascript login SDK. I followed this tutorial https://developer.linkedin.com/docs/signin-with-linkedin
I got this error
The text content of element script was not in the required format: Expected space, tab, newline, or slash but found a instead.
in this code block
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: YOUR_API_KEY_HERE
authorize: true
onLoad: onLinkedInLoad
</script>
The problem that this code is provided by the tutorial.

I solved this problem by separating the loading of the API and the initiation of the API.
<script src="http://platform.linkedin.com/in.js?async=true"></script>
<script>
IN.init({
api_key: 'YOUR_API_KEY_HERE',
onLoad: onLinkedInLoad,
authorize: true,
scope: 'r_basicprofile r_fullprofile r_emailaddress r_contactinfo',
});
</script>
this code is valid code by W3C

Related

linkedin and onLinkedInLoad

I have the possibility of LinkedIn login to my website, to postulate for a job. . I followed the tutorial given on the LinkedIn developer page, this is my code:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: [...]
lang: fr_FR
authorize: false
onLoad: onLinkedInLoad
</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);
}
// Handle the successful return from the API call
function onSuccess(data) {
console.log(data);
}
// Handle an error response from the API call
function onError(error) {
console.log(error);
}
function getProfileData(){
[...]
}
</script>
The login button appears, this means that LinkedIn was able to connect to my API key correctly, but the Chrome console gives me the following error: Uncaught Error: Could not execute 'onLinkedInLoad'. Please provide a valid function for callback..
I tried to remove the onLinkedInLoad event listener :
<script type="text/javascript">
IN.Event.on(IN, "auth", getProfileData);
[...]
</script>
... but i have the same problem.
Theses scripts are called in head (php include of all pages of the website (i need this linkedin login on all pages)).
It works on ONE page, but not on the others... i don't understand.
Thanks a lot !
Need to below script available for all pages where you want login button. if you are putting this script on particular page then lgoin button will work on that page only.
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: [...]
lang: fr_FR
authorize: false
onLoad: onLinkedInLoad
</script>

Unable to embed google plus posts

I am trying to embed google plus posts in my application.
I have loaded platform.js file in header
<script>
window.___gcfg = {
lang: 'en-US',
parsetags: 'onload'
};
</script>
<script src="https://apis.google.com/js/platform.js" async defer>
</script>
<script>
function renderWidget() {
gapi.post.render("widget-div", {'href' : 'https://plus.google.com/109813896768294978296/posts/hdbPtrsqMXQ'} );
}
</script>
In html page
Render the embedded post
<div id="widget-div"></div>
When I clicked on the link, it shows nothing. Is there anything to be added. Here is the reference i followed https://developers.google.com/+/web/embedded-post
You might be opening HTML file directly in browser, which could be problem in some browser(s) (i.e. In Google Chrome. You can verify the issue here).
Try running it using a local-server(XAMPP maybe) so the URL will look similar to http://localhost/yourpath/test.html
Hope this helps!!

LinkedIn apply button not displayed

I've created new app in the LinkedIn developer website, and inserted this code on my website:
In the head:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: MY_API_CODE
authorize: true
onLoad: onLinkedInLoad
</script>
In the body:
<script type="IN/Share"></script> <br>
<script type="IN/Login"></script>
<br/><br/>
<script type="IN/Apply" data-email="test#example.com" data-jobTitle="Testing" data-companyID="1337"></script>
Both share and login buttons are shown but not the apply button.
Can someone tell me what the problem here is?

How to use SmartyStreets LiveAddress Plugin with dynamically loaded form

I am trying to get the LiveAddress website plugin to work in a Wordpress website. The form is loaded dynamically via javascript.
It seems that the form is not visible to the plugin at the time the plugin loads.
The plugin shows the following message in the javascript console:
NOTICE: No matches found for selector #field_96764599. Skipping...
The form I am trying to use is generated by Podio (podio.com), but I have tried the same without success using a form hosted by jotform.com. If I copy the HTML of the form and paste it on the page, it works. The problem happens when the form is loaded via javascript.
Can someone see what I am doing wrong? Thanks.
<!-- BEGIN Podio web form -->
<script src="https://podio.com/webforms/12651261/927644.js"></script>
<script type="text/javascript">
_podioWebForm.render("927644")
</script>
<noscript>
Please fill out the form
</noscript>
<div class="podio-webform-container">
A webform by Podio
</div>
<!-- END Podio web form -->
<script src="//d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/2.8/jquery.liveaddress.min.js"></script>
<script type="text/javascript">
var ss = jQuery.LiveAddress({
key: 'HERE IS WHERE I PUT MY KEY',
waitForStreet: true,
debug: true,
addresses: [{
street: '#field_96764599'
}]
});
</script>
I know this is a bit late but have you tried using .ready() with jQuery?
<script type="text/javascript">
$( document ).ready(function() {
var ss = jQuery.LiveAddress({
key: 'HERE IS WHERE I PUT MY KEY',
waitForStreet: true,
debug: true,
addresses: [{
street: '#field_96764599'
}]
})
});

LinkedIn Login button is not displaying

I am trying to access linkedIn from my website. For that I have created a new Application and get the API key. And implemented in my code below. This gives me the blank page but works only in Javascript API developer console.
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: mykey
authorize: true
</script>
</head>
<body>
<script type="In/Login">
Hello, <?js= firstName ?> <?js= lastName ?>
</script>
</body>
Please help to get the login button..
The code looks alright as far as I can tell. As mentioned in the docs:
Verify that your API key, is specified in the framework script tag.
Verify that the full domain name you are using to access the html
file is specified in the key's configuration details.
Check your JavaScript Console for any framework errors.
If you are using Firebug or WebKit's Developer Tools, check to make
sure that the following files were loaded automatically: in.js,
userspace.js and framework.js
I found that you need a specific jQuery version to make the button appear!
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5b1.js"></script>
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: xxxxxxxxxxxxx
onLoad: onLinkedInLoad
authorize: true
</script>
And to show the Button you will need also this somewhere BUT INSIDE A BODY TAG!!!
<body>
<script type="IN/Login"></script>
</body>
hope that will give some light to the issue!

Categories

Resources