Rails: Hide Url for a link_to when users inspect element - ruby-on-rails

I have a field in my form where users can put their facebook page for example and in my show page I have a button that redirect users to this facebook page but I want when user Inspect element the URL of the facebook page will be hidden now i have a code like this when I inspect element with Mozilla <a class="btn btn-default" target="_blank" href="http://www.facebook.com"></a> but I want the the facebook URL to be hidden

You can't do this. It is impossible to have something people can click on but which the user can't tell the destination of before clicking. You can make it more or less hassle, but the ultimately the browser has to know, and the browser isn't interested in deceiving the user.

Related

browsing inside an iframe

I have a wordpress page that loads an
iframe prompting the user to navigate through bing to a webpage he/she wants. After browsing and upon arriving at the page the user wants he/she has to press a button to copy the current ulr to the clipboard or to print the url through alert() or on screen.
Question: is there a status attribute or something else that can give me the current status / metadata of the iframe (i.e. what page the iframe is visiting at a specific moment?). Thank you very much!
You cannot, it is forbidden to access any contents of an iframe that is not from your own domain, this is because of cross-site scripting restrictions.
You can read more about that here:
http://en.wikipedia.org/wiki/Cross-site_scripting
If you would be on the same domain however, you could do something like this in jQuery:
var url = document.frames['example-frame'].location.href;
when you would have an iframe like so:
<iframe name="example-frame" src="www.example.org"></iframe>

invite facebook friends to application without a popup rails

I'm making a simple application to practice learning rails and web development in general.
What I'd like to do is list facebook friends so that I can invite those that don't have the app to come use it with me.
Currently I'm following a tutorial which pops up the friends on facebook I can send the application to. However I'd like to remove the popup option and simply display on the page the facebook friends invitation list (i.e. checkbox, name, picture). How would I go about doing that?
Here is my code of Home.html.erb. Please let me know if you have any suggestions. Thanks!
<div id="friends">
#instead of the below link which creates the pop up, I'd like the page to
#simply display the facebook friends to invite
<p><%= link_to "Invite your Facebook Friends","#",:id=>"invite_fb_friends"%></p>
<div id="fb-root"></div>
<script src ="http://connect.facebook.net/en_US/all.js"></script>
<script>
$(function(){
$("a#invite_fb_friends").click(function(){
FB.init({
appId:'1234567890', #<--fake appid, my code includes the my actual app id
cookie:false,
status:true
});
FB.ui({method:'apprequests',message:'<%=current_user.name%> would like to invite you to try out our app!'});
});
});
</script>
</div>
You can get a user's friends info (provided you have the permissions in the access token) via:
https://graph.facebook.com/:facebook_user_id/friends?access_token=token
You'll receive a json response of the user's friends. Simple parse the JSON code, and from their create a list of friends in the view. Use check boxes or something, compile each ID they select, and create a request
To see what the data looks like, goto: https://developers.facebook.com/tools/explorer
and put in /me/friends

Paypal - redirect after payment to my own page

I would like to automatically redirecta a user after successful payment to my own "thank you" page. Currently I am working with Paypal under the sandbox account and on my localhost.
Is there any way to do it? I tried to browse through the admin account in sandbox, but I didn't find something useful...
You simply need to add a "return" variable to your button.
If you're manually creating the button, it's just a hidden field named "return" with value set to your Thank You page. Eg:
<input type="hidden" name="return" value="http://www.mysite.com/thanks.html"/>
If you're using an encoded button, then you can set this in the button wizard page of the PayPal site.
From PayPal's Payments Standard documentation [ https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables ] (It's quite long so just do a search for "return") :
return
The URL to which PayPal redirects buyers’ browser after they complete their payments. For example, specify a URL on your site that displays a “Thank you for your payment” page.
Default – PayPal redirects the browser to a PayPal webpage.

When linking to a twitter/fb/other page, why do this: "dribbble.com/username/click?type=twitter" instead of a normal link?

I was just viewing a users profile on dribbble.com, they had linked their profile with twitter, when hovering over the link to go to their twitter page, it shows a url like this:
http://dribbble.com/thyraz/click?type=twitter
I'm wondering what the website/coding reason/advantage for doing this would be? why not just put a normal link to their twitter profile? does this protect the website from phishing attempts or something?
dribbble could be tracking/counting the links?
eg, "click" could be a page which counts the click, then it sends them on their way to the page.
EDIT:
For example, search Google for "Stack Overflow" and hover over one of the sponsored links on the right. in the status bar, you will see the link goes to a page hosted by Google rather than to the actual link. This page will be keeping a record of all the clicks on that link, then redirecting the link as expected.

Facebooker with Authlogic is Not Redirecting to the Dashboard After Authorization

Everything seems to be working fine with my implementation of Facebooker with Authlogic (using the authlogic_facebook_connect plugin) except for one thing.
After the initial authorization of the application (by clicking OK on the Facebook pop-up) I still remain on the login page. There is no redirection. However, once I refresh the login page and then click the Facebook button again, there is no popup because it is already authorized by Facebook, instead it redirects to /user_session (for authentication via Facebook session) automatically and immediately takes me to the dashboard page as expected.
Additional Information:
Any idea why it doesn't redirect on the very first click, right after authorizing Facebook? The post-authorize URL is set for http:///user_session/ and the routes for authlogic are set properly.
I have tried with Prototype and jQuery, both give the same results.
You can see the same issue on this tutorial website if you try to authenticate with Facebook. This website is not mine so try at your own risk:
http://facebooker.pjkh.com
Thanks.
Also having the same issue here. I think the reason it was doing nothing for me, using jquery, is the code generated by
<%= authlogic_facebook_login_button :controller => 'customer_session' %>
which is something like
<form id='connect_to_facebook_form' method='post' action='/customer_session'>
<input type='hidden' name='authenticity_token' value='keLV8CIfc5znsRkjhkjhkjhkjhkjh='/>
</form>
<script type='text/javascript' charset='utf-8'>
function connect_to_facebook() {
$('connect_to_facebook_form').submit();
}
</script>
<fb:login-button js="prototype" onlogin="connect_to_facebook()"></fb:login-button>
the jquery to submit the form is wrong it should be
$('#connect_to_facebook_form').submit();
(duh, because I did not pass in :js => :jquery)
but if I fix that I still get
1 error prohibited this customer
session from being saved
There were problems with the following
fields:
* You did not provide any details for authentication
so the right details are not being injected into the form I guess

Resources