Forum Moderators: coopster

Message Too Old, No Replies

Automatically clicking a button on my site

automatic buttons

         

Adam_Gold

9:49 am on Apr 26, 2010 (gmt 0)

10+ Year Member



Hey there

I've just discovered this forum and it looks great
so first thing's first, hello everybody!

Now for my question:

I'm promoting an ebook, which at the end (inside the pdf file) asks the reader to
"click here" if he likes the book.

When he clicks, a new window opens at this url:

<snip>

I want to know if there is a way to automatically press the "like" button on that page.

Because in order to get to that page, the reader has already pressed a "like" button at my ebook (the pdf file).

So what do you say?

any help would be greatly appreciated!
Thanks in advance,

- Adam

[edited by: eelixduppy at 11:54 am (utc) on Apr 26, 2010]
[edit reason] no personal URLs, please [/edit]

Matthew1980

10:14 am on Apr 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Adam_Gold,

Welcome to the forum!

Well, when you create the PDF, can't you just add a link to take you to a site where there is a form with the book details and rate it from there? Just a thought from quickly reading the post, also, see the T.O.C for future posts, no personal url's if that is one, the mods will nuke it.

I hope that gives you an idea of what to do..

I'm sure as there will be many suggestions for this question though ;-p

Cheers,
MRb

Adam_Gold

3:04 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



Hey there matthew,
thanks for your response and warm welcome :)

didn't It's a "no no" to post urls here.
Sorry cool admins, won't do it again!

As for my question:

The pdf has a link inside that says:

"if you like my ebook, please let me know by "clicking here"

that takes them to a page with the facebook "like" button.

I want to make things as simple as possible for my readers since they aren't savvy when it comes to the internet :)

That's why I want to know if there is a way to make a script or something to press the button automatically when they visit the url.

Thanks in advance for helpers!

rocknbil

5:21 pm on Apr 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's why I want to know if there is a way to make a script or something to press the button automatically when they visit the url.


Probably many, but two immediate ways come to mind.

The first is without Javascript. In the link to download the PDF, instead of

<a href="my-pdf.pdf" target="_blank">download</a>

(or similar)

Do

<a href="download-handler.php" target="_blank">download</a>

Then in download handler, do whatever action "like" does, then print out the PDF file as an attachment (or, just print it out with content-type application/pdf if you want it to display.)

The other is via Javascript, you add an onclick event handler to the link,

<a href="my-pdf.pdf" onclick="send_like_request();" target="_blank">download</a>

then create the Javascript function send_like_request() that makes a request to the url in the like link via XMLHttpObject.

I'd go with the first, as it will fail with JS disabled.

Adam_Gold

5:30 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



Thanks for the info man.

The thing is, the facebook "like" button is something
I can't do from my site. It's an Iframe from facebook...

I don't think there is a way to make the same action on a site outside facebook.

and the "like" button should be clicked only if a person reads my ebook and press the "like" link inisde the ebook

Anymore Ideas?

Matthew1980

6:00 pm on Apr 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Adam_Gold,

Well if you generate the PDF & can place the link in there, I don't think that you even need a link on the page you are going to direct to. Basically what I am suggesting is to have the information attached to the URL from the PDF, something like this (assuming that there is no rating system from 1-5 etc):-

<a href="rate-my-book.php?process=rate&amp;author=DanBrown&amp;like-it">If you like this ebook click here :)</a>

Basically from this link (I think) you can use $_GET to catch the info you want, and then parse the data from there and display a nice page like, "Thanks for rating the book, have a great day!" Or words to that effect.

This method will basically negate the need for a like button, as the info is in the URL.

If I am wrong, I am sure that I will be corrected ;-p

Hopefully you can see what I have tried to do with the url.

Cheers,
MRb

Adam_Gold

6:16 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



Yeah I figured it will be something like this the problem is,
again, this is an Iframe from facebook.

I don't know how to access it from outside.

Maybe... Building a script that clicks a button through it's location in the web page?

Anywayz I'm, kinda new to this techie stuff so go easy on me :)

CyBerAliEn

7:37 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



I haven't done anything with Facebook yet (programming speaking)... but I do know that Facebook offers APIs.

Essentially... there should be some sort of means for you to write PHP code in a PHP page on your site that can send the same thing as "clicking the like button" over to Facebook for processing via their API? Perhaps someone with experiencing working with Facebook could give specific examples or insight.



UPDATE (edit)...
It looks like FB's API allows you simply to include the HTML iframe code to do the "like". But it doesn't look like (with a cursory research) that there is any deeper means of performing a "like".

Adam_Gold

8:25 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



Thanks for your input CyBerAliEn

I do have the Iframe in my site.

What you said about the API thing can lead to the answer maybe.

Insights anyone?

Matthew1980

8:52 pm on Apr 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Adam_Gold,

Just had a look on FB (useless site cluttered with rubbish IMO) for the API stuff, and there is a help link at the bottom so I put in API and there are a few helpful FAQ's there, and even a youtube vid (poor quality, the guy needs a new marker ;p)

Other than that I'm not sure, hopefully you can find an answer on there somewhere.

Cheers,
MRb

Adam_Gold

9:36 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



Matthew please call me Adam :)

I've looked into the api page of FB.

Other then the Iframe, there is this code:

<fb:like href="http://developers.facebook.com/" layout="standard" show_faces="true" width="450" action="like" colorscheme="light" />

This is xfbml which I know nothing about...

Still waiting for an answer people!
haven't given up on the solution :)

Readie

9:41 pm on Apr 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just had a look on FB (useless site cluttered with rubbish IMO)

I just wanted to quote it :)

---

Anyways, have you tried contacting the folks at FaceBook directly Adam? I know they'll probably give you some canned answer and a link to the FAQ you've already read, but you might get lucky.

CyBerAliEn

9:58 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



<fb:like href="http://developers.facebook.com/" layout="standard" show_faces="true" width="450" action="like" colorscheme="light" />

I'm not familiar with this either... but the vague reference on the FB dev site indicates this is code you can use on your site, but that it has to do with the Java SDK (? - not sure how they relate).

To be honest, it looks like you're stuck. It appears the only means FB allows for "liking" is to use that IFRAME approach. It kind of makes sense if you consider it... if they opened the doors so that anyone could "input" a "like" directly/dynamically, it opens the door to abuse (ie: software 'inputting in' that people "like" something when they never did anything or clicked anything).



I'm not too familiar with PDF development; if you could insert an IFRAME into your PDF, go for it! But I doubt this, lol... but what I would recommend is something like this:

Inside the PDF, add a link/banner that says "Recommend; Digg; Like; etc" (whatever). Have it link to a PAGE on your website, ie: http://www.example.com/article12/like.php

On this page, add buttons/links/etc to do the "like" (and any other similar tidbit you want). This is probably your only and best means for accomplishing this. This way, anyone with the PDF has a link to take them to your article and this link then allows them to "social" it.

Sorry... just doesn't seem there is any "good" way to do it; namely because: (1) technology barriers [websites, languages, PDFs, etc; all different] and (2) FB only has certain "doors" you can go through to do things, you gotta work with what they give you.

rocknbil

6:55 pm on Apr 27, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the problem is, again, this is an Iframe from facebook....I don't know how to access it from outside.


This changes **everything.** :-) For two reasons. The first is cross frame manipulation is only possible if both framed pages come from the same domain. Think about it, if I could include your site in a frameset and swap out all the links to some nasty virus site, I'd damage your reputation pretty quick. Browser don't allow cross frame manipulation for frame sources outside the parent domain, period.

The second is, if the one purchasing the product does not have a Facebook account, they won't have privileges to "like" something. Since this is something you'd attempt before completing the download/sale, it would likely result in a process that stops at the Facebook login screen. And there goes your conversion.

Take the high road . . . "If you like this download, let us know on Facebook. <link>"

Adam_Gold

7:50 pm on Apr 27, 2010 (gmt 0)

10+ Year Member



That is not a conversion man :)

It's simply a way to gain free exposure.

Thanks for the info though!