Why is this in codesandbox undefined? - codesandbox

If I enter this into a typescript or javascript sandbox I get
console.log(this) // undefined
If I enter it in the google developer tools console it is window.
In tools this===window is true
In Sandbox it is false.
Any idea why this is not bound to window in the codesandbox.io?

If you create a vanilla JS sandbox then this will be undefined because of ES6 as mentioned by #Sergei, so better go with a Static HTML sandbox

Related

How to solve facebook login plugin configurator error?

I am using Facebook Login Pluginator(https://developers.facebook.com/docs/facebook-login/web/login-button#plugin-configurator). On click of that button it will open popup itself(As pop up is opening after click event so browser will not block popup).There is error message for developer like below.
"You are using a display type of 'popup' in a large browser window or tab. For a better user experience, show this dialog with our JavaScript SDK without specifying an explicit display type. The SDK will choose the best display type for each environment. Alternatively, set height and width on your window.open() call to properly size this dialog if you have special requirements precluding you from using the SDK. This message is only visible to developers of your application."
How can i fix that?
I am using v5.0 facebook js sdk.

Squarespace code injecting

I injected <script> tags into my squarespace template making the <main> display:none. Now I cannot edit that section through squarespace because it is gone. Recommendations how to get it back without starting from scratch?
$( "#page" ).css( "display", "none" );
was the code I injected into the HTML.
Thank you in advance.
Its hard to understand what you are asking, but i'll assume that you added that single line of code, it hides everything when you navigate to your site page, and you are not sure how to go back to the adminstration page to remove that line of code?
You used "code injection" to insert that code. You can go back to that same code injection location and remove that line of code. The squarespace manual has documentation on code injection. If you are not sure where to go to get back to the administration pages, you can enter a url like this: https://<yoursite>/config for example: https://mysquarespacesite.com/config
For your problem I have one solution using Chrome inspector console tool(inbuilt tool of Chrome browser), make sure you open your website on Chrome browser with login to your squarespace website and follow these steps:
On your website homepage for example: https://<yoursite>/config, Click F12 from your keyboard OR right click using mouse and click on Inspect which will show you inspector mode of Chrome browser
Go to Console tab from inspector tool
Paste following code into Console:
document.getElementById('page').style.display = "block";
Hit enter and your <main> tag will be set as display block
Now your <main> section should be visible, go to code injection of your website and permanently remove display : none which will fix your website hiding <main> section problem for forever
Following are pictures of every step:
Note: I have tested this code into demo template of Squarespace website: https://bedford-demo.squarespace.com
Use the below code. Your code will execute only when you are not logged in as administrator.
if (window.top.location.href == window.self.location.href) {
$("#page").css("display", "none");
}

Heroku - Created a facebook app with Node.js which gives type error

I am trying to create a facebook application and this is my first time. I read several articles on how to create one and I created an application from this page https://developers.facebook.com/apps. When I clicked on Go to App from facebook right after I created it. It is showing this error
I have tried to look on Heroku dev center for same type of problem to resolve problem on my own I couldn't find any solution. When I do curl -v https://tranquil-oasis-2533.herokuapp.com it says HTTP/1.1 500 Internal Server Error. This is the output from heroku logs http://pastebin.com/0qdueiZE. Somebody please help me.
This appears to be an issue with the faceplate module. It is described here: https://github.com/heroku/faceplate/pull/20
You have two options to get around the issue:
Propose a fix to faceplate that works within the constraints of the Facebook application security here: https://developers.facebook.com/docs/ApplicationSecurity/
Take your Facebook app out of sandbox mode.
This seems to be issue with sandbox mode. Disable sandbox mode. Here is the steps how you can do it.
Go to https://developers.facebook.com/apps.
click "Edit Settings"
and selected radio button "disabled" for the "Sanbox Mode" under "basic info".
Hope this helps.
The error message points to what needs to be known
Cannot read property 'name' of undefined
<title><%= app.name %></title>
app is undefined. Probably want to check your web.js file to see what app is up to.
And ensure you have the latest node template for Heroku.
https://github.com/heroku/facebook-template-nodejs
My guess is that you aren't passing app as a local to the index.ejs template. If you're using Express, console.log(res.locals) before you res.render index.ejs. Is app in the logged output?

settings > auth dialog shows blank

The new Settings > auth dialog page is blank for one of my apps. In other words I am unable to setup/config the new auth dialog for that app.
Yes, I have set Settings > Advanced > Enhanced Auth Dialog: Enabled but that is not actually relevant because that setting is to show the new dialog - not config it. Also, it is not enabled in my other apps and they all load the auth dialog config page correctly.
So, I can't setup nor config the new auth dialog - any ideas appreciated.
I had this issue and it seemed to resolve itself when I setup previews for my aggregations and actually previewed them. My auth page returned. Not sure if that was coincidence or if it will get it back for you. This is currently a known bug in the system and I'm sure they're working on getting it fixed without this kind of work around.
As Dustin Nielson said, worked for me, although I didn't get it at first. So in more detail: in developer, go to apps, to your app (you might already be there), pick 'Open Graph' and then work yourself through the 'wizzard'. Leave it as is for now and try again to go to the Auth Dialog settings page.

XFBML button doesn't appear

Situation: I am running my website on wordpress. I have installed the "Simple Facebook Connect - Base" plugin and configured it by getting the API key for my website. Then I inserted the like button on my own at my own preferred place in the page using i-frame. It worked fine.
Problem: But I thought to try the XFBML version. I loaded their JS SDK as said here. But now, when I try to use the fb:like tag, nothing appears. Chrome's javascript console tells me that the div in which I wrote the XFBML tag is of zero height.
Question: How do I get through this? Is there anywhere that I went wrong.
Check that you are calling FB.XFBML.parse either on the whole document, or the elements that you want to be parsed for XFBML. The old JS library used to do this automatically, but in the new one you have to do it manually.