Solved

Facebook Like Syntax For Dynamic URL

Posted on 2011-02-22
13
673 Views
Last Modified: 2012-06-27
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.swedishmotors.com%2Fcars%2Fpages%2Fcar_search_full_details.asp%3Fid%3D<%=rsData("strcarid")%>&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=tahoma&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

I am trying to get a facebook like link for a dymanic url - http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=582

I tried replacing the 582 with <%=rsData("strcarid")%> wihich holds the value.

If you visit the url you can see the error.

Thanks!
0
Comment
Question by:swedishmotors
  • 7
  • 6
13 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
What exactly is the problem as when clicking on the above link I don't get an error.
Show us your link code in your asp so we can try and help
0
 
LVL 1

Author Comment

by:swedishmotors
Comment Utility
<%response.write(Server.URLEncode("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid))%>

 <iframe src="http://www.facebook.com/plugins/like.php?href=<%response.write(Server.URLEncode("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid))%>&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=tahoma&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

I have update my code to URLEncode the link.
When you click the like button at the very bottom of the page, then unlike you get an error in the facebook feed.
0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
You have a " that doesn't have have a matching " here : height=80" , fixing that might fix the problem

if that doesn't work try :

dim url = "http://www.facebook.com/plugins/like.php?href="http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid & "&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=tahoma&amp;colorscheme=light&amp;height='80' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:450px; height:80px;' allowTransparency='true'"

<iframe src=<%response.write(url)%></iframe
0
 
LVL 1

Author Comment

by:swedishmotors
Comment Utility
Currently I have this:

<iframe src="http://www.facebook.com/plugins/like.php?href=<%response.write("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid )%>3E&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;font=verdana&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px; allowTransparency="true"></iframe>

Facebook Error: The page at http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=5903E could not be reached.

I do not know where the 3E is coming from? http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=590 is the link to my page.
0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
You still have a " without a matching starting quote on the height attribute. colorscheme=light&amp;height=35"

I suggest you use the approach I said in my previous post
0
 
LVL 1

Author Comment

by:swedishmotors
Comment Utility
I have tried that:

<iframe src="http://www.facebook.com/plugins/like.php?href=
<%response.write(Server.URLEncode("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?"&(Request.QueryString)))%>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:35px; allowTransparency="true"></iframe>

I believe the problem is right here: ?"&(Request.QueryString)))%>
It is not pulling the QueryString.

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Comment

by:swedishmotors
Comment Utility
I have also tried this -
dim url
url= "http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid
response.write(url)


<--iframe src="http://www.facebook.com/plugins/like.php?href=<%response.write(url)%>3E&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;font=verdana&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px; allowTransparency="true"></iframe>

This returns-
<--iframe src="http://www.facebook.com/plugins/like.php?href=http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=5903E&layout=standard&show_faces=false&width=450&action=recommend&font=verdana&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px; allowTransparency="true">
0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
You still don't have that quote in which is why the string is being closed after the height =35" change it to height='35'
and take out the 3E from <%response.write(url)%>3E
0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
or is that where the href is supposed to end? if so maybe you just need to take out the 3E ?
0
 
LVL 1

Author Comment

by:swedishmotors
Comment Utility
It seems the iframe now load fine - but the functionality with facebook is not working - you get an error when you click like.  It is like Facebook is not interacting with the url correctly?
0
 
LVL 29

Expert Comment

by:Paul Jackson
Comment Utility
The error is coming back as 'The page at http://swedishmotors.com/cars/pages/car_search_full_details.asp could not be reached.', i have no idea but it does seem to be a problem at facebooks end or as you say it is not interacting with the url correctly.
0
 
LVL 1

Accepted Solution

by:
swedishmotors earned 0 total points
Comment Utility
I found this is the only way:

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like show_faces="false" width="450" action="recommend"></fb:like>
0
 
LVL 1

Author Closing Comment

by:swedishmotors
Comment Utility
I found the fb library is the only way to accomplish this.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now