0

I try to make a facebook share function using link_to method.

This my share link helper

urlencode=ERB::Util.url_encode("http://fbjstest.herokuapp.com/posts/#{id}&t=#{title}");
url= "https://www.facebook.com/sharer/sharer.php?u=#{urlencode}"

It will make a url like this.

https://www.facebook.com/sharer/sharer.php?u=http://fbjstest.herokuapp.com/posts/9&t=Cool

My Problem is :

When I click cancel or submit button , it didn't redirect to original website.

Any Suggestions ?

thanks for help

Community
  • 1
  • 1
AlohaCC
  • 87
  • 1
  • 9

1 Answers1

0

I find the root cause...

I try to open the link on "new page" , It solve my problem.

<%= link_to 'Share to FB' , fb_share_link_maker(params[:id],@post.title) , :target => "_blank", :class => "btn" %>

Key point is

:target => "_blank"

Thanks

AlohaCC
  • 87
  • 1
  • 9