Google Sites Login System - javascript

I know this question has seemingly been asked. Without solution.
That said, I did try to do my research on it and I haven't found a complete solution.
I'm trying to create a login system for google sites. Login on the homepage and until you do you cannot view any other page or be able to access it. That said, I'm honestly struggling with the of viewing other pages, so how would I do that?
I have considered making the menu myself and disabling the normal one - but then couldn't they just type the url www.site/page-i-don't-want-you-to-see?
So what's the solution? Adding googlescript on every page to verify? EDIT: Very noteworthy to point out: https://support.google.com/sites/answer/1387646?hl=en&ref_topic=1387383 there is page restrictions if you want to do it manually. A bit impractical when you could to sites that should have a decent number of people.
What I DO have done right now is a login app using a spreadsheet ( Don't worry - passwords are encoded. Only reason I am using a spreadsheet and not a database is I'm making the site for someone else as well) which you can create an account and try to log in.
I'm going to put the login app on the homepage, and a login checker on every page so essentially the question becomes: How can I redirect using a appscript? I tried the html redirect method using a refresh and a url which hasn't worked and a few not noteworthy javascript methods all that have failed.
Edit: Bump!

Related

How to redirect people from Tumblr to random site?

I want to redirect people from my tumblr to another site, like example.com
But when I try to change HTML in tumblr theme adding http://example.com"> nothing is happen, only error.
Is there a way to redirect people? May be using javascript or something else?
You can redirect in javascript.
If you want to keep the current page in the browser's history:
window.location.href = "https://example.com";
If you want to pretend the current page was just a 3xx-style redirect, and not have it in the browser's history:
window.location.replace("https://example.com");
That said, please keep in mind Tumblr's Community Guidelines, particularly the "Spam" section. Also, the Terms of Service. Any redirect should be expected, from the point of view of the user, and not solely for the purpose of generating revenue.

Clean way to post users web page shares to Facebook page

I am looking for a way to show Facebook engagement on from our website on our Facebook page. IE, when someone likes/shares etc. a page on the website, that that activity be reflected by our Facebook page in some way.
I was planning on using the graph API calls to do page updates, but the permissions are granted to users, not to the app itself, meaning this would only be possible for existing administrators, defeating the whole purpose (Perhaps a bit obvious in hindsight).
Is there a good, clean way of posting page likes/shares of our web pages to our Facebook page feed?
Notes:
I'm working in PHP and/or client side JS
A high volume of posts drowning our regular content is not likely at the moment, however, advice about how to manage such a beast in the long run might be helpful
If I understood correctly and want to share content from Facebook into your Website, the behavior you mention used to exist via the Activity Feed or Recommendations Feed. However, it has been deprecated since Graph API version 2.3.
If what you want is to update comments from people in your Website to your FB Page, you could implement something in your backend which listens to content uploaded and uses your Page Access Token to create custom stories using your user's data. As you mention, it won't happen in the name of people, but you could be creative and make the text narrate what people did on your website. Maybe even use OpenGraph for this.

How do I make Facebook like-detection work on my website?

I have built a simple webpage in PHP. I want to tell if users like my page (I placed a like button on it). It is not a Facebook app. I have seen this, but don't know how to use it with PHP. I don't know JavaScript at all. I tried pasting the code listed at the link into my page, but it didn't do anything useful.
A PHP solution would be preferable. I don't want to build a Facebook app, I just want to know if the Like button has been pressed.
Any help would be appreciated. Thanks!
Edit: Here's the link to my website, per answerer request: testingground.comyr.com
Those Edge events are only usable to detect if the user clicked the Like Button right now, but you cannot check if he already liked your page. That is only possible with an App, and user authorization with the "user_likes" permission.
More information:
Check if logged in user has liked my Facebook Page
Check if user liked page or not
Why don't you use the Facebook developer reference documentation?
Without an API Access, I think there is no possibility to do that.
How should you have access the private token what a random user liked?

JS API - Any way to tell if a user is posting as himself, versus posting as a Page he adminsters?

I have a basic JS API application that posts a score update for a game to both a user's wall and a Page. In testing, one person who posted was posting as a Page, rather than herself, so the post to the Facebook Page showed up as being posted by the Page she was administering, rather than her own profile. So I'm wondering if there's any way to switch the "Voice" the user is using, via the API. I saw something about a profile selector attribute in one of my searches, but couldn't get the selector to show up, so either I was doing it wrong or it's been deprecated? Any help appreciated!

Streamlined way to validate website ownership (with javascript?)

I have a rails app which requires users to verify that they own a website before submitting links from that site.
I have implemented a website verification system that works thanks to the answers given to a question I made several months ago. This system works but it is rather cumbersome for users. It requires them to create a web page on their site with a specific verification key for a url. I feel like I'm asking the user to jump through a lot of hoops just to submit their pages to my site. Site verification is vital, however, and I can't let go of this feature, however cumbersome.
I'm looking to create some javascript code that will help validate websites. When users install the plugin, all they would then have to do is click "verify" on the web app, and all the work is done for them. They don't have to go through the chore of creating a new web page and deleting it.
I have a faint idea of how to get started...
Step one: the javascript code to be placed on the website (simplified version of google analytics code):
"<script type='text/javascript' id="THE VERIFICATION CODE GENERATED BY THE RAILS APP">
(function() {
var secondScript = document.createElement('script');
secondScript.type = 'text/javascript';
secondScript.src = 'http://www.mywebapp.com/verify.js';
var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(secondScript, firstScript);
})();
</script>"
In the second script(verify.js):
//find some way to ensure that the first script has an id of "VERIFICATION KEY"
//if so, return some data that the rails app can understand and verify the site
Any ideas?
That's a REALLY interesting problem, but I don't know if there is a good solution in the way you're looking for. In other words, I don't think you can create some sort of automated utility to upload the script in step one.
You can't assume they have FTP access, or SSH access; some web hosts might disallow those things. You can't assume they have some sort of 'package' installed to communicate with, or even the ability to install such a thing.
One thing that might work (but still has its own set of issues) is to do a whois lookup and email the owner of the site on record with a confirmation link... Of course that's assuming the whois is listed and they didn't provide a dummy email.
Google accounts checks for domain ownership by doing the file upload thing, or letting the user create a custom subdomain (CNAME) on the site. Of course, if your users are having issues uploading a single file, the CNAME thing is probably right out.
There are other ways to verify ownership of website. Many companies will send an e-mail to the registrant of the domain. Create a file with a certain name. Put a piece of specific text into the header of the index page. I think the way you're attempting above is more complex than it needs to be. It's pretty easy for any webmaster to create a file with a certain name and with certain content. I've done it many times for different tools.
Don't sweat it :-)

Categories