What's the difference between a PageMod/page-mod and a Page/page-worker? - firefox-addon-sdk

I don't understand the difference. The only difference I can see is that a PageMod uses a match pattern, whereas a Page uses a specific URL. Why not just use a PageMod (more versatile) for everything?

The page-mod module works with pages that the user loads in the browser. The page-worker module lets you load a web page in the background and perform some operations with it. So you would for example use page-mod if you want to add a "Super-Dooper-Search" button to all Google Search pages when the user visits them. But you would use page-worker if you want to load the Google Search page in background when the user clicks some button, extract the search results from it and present the results to the user - without the user ever seeing the page you loaded (just as an example, don't actually do that because it violates Google's ToS).

Related

displaying own like count next to like button

I have a website where the URLs have some tracking parameters that do not affect the page that is displayed i.e. the URL is of the form http://mywebsite.com/page1?tracking1=aaa&tracking2=bbb and 'tracking1' and 'tracking2' are just tracking parameters used for some other purpose and do no determine the page that is displayed. The page that is displayed is always 'http://mywebsite.com/page1' irrespective of the values of these tracking parameters.
I have included the facebook like button on my website pages and facebook treats each of these URLs, including the tracking parameters, as separate pages. I'm not able to get facebook to ignore these tracking parameters and just consider the URL without tracking parameters as a page. So, I'm storing my own like count against the actual URL (when I get a callback on the like action) and displaying it next to the like button.
Is displaying own like count next to facebook like button against their usage policy? Is there a better way to do this?
Is there any particular functional reason you're using GET (ie URL) variables to store your tracking?
If you can push them into POST instead, or use cookies or sessions for your tracking, you can simplify your URLs and Facebook should treat it as a single page.
If you have to use GET due to, for example, the links coming from external websites, you could use a pass-through URL to do your tracking, before forwarding to the main page. ie someone clicks the link to redirect?tracking1=aaa&tracking2=bbb&page=page1
And redirect, as you may have guessed, does what you need to do with your tracking before forwarding the user on to page1.

Callback from Facebook app as a tab app on multiple pages

Salon owners can create an account with their salon information on our platform and they get a page that they can use as a tab app.
I want to be able to serve all these pages from one app instead of having to install each one seprately and I also want to make the life of the salon owner easier by helping them to install the tab.
I know about the link I can create to help them install the app and I know that when a visitor visits the app that facebook will send the page ID. So far so good.
https://developers.facebook.com/docs/appsonfacebook/pagetabs/
But how do I make sure that when the salonowner follows the link to install the app that I get the page ID back (through callback or other) so that I can register which page ID belongs to which salon account.
I've read sone 2011 article about a callback but I can't find any recent info on this.
I think it should be possible as a lot of sites offer easy fb apps to businesses.
Any help would be welcome!
EDIT: Could this last piece of info in the Facebook link above be used to do this? I don't quite get it yet.
In addition, your app will also receive a string parameter called app_data as part of signed_request if an app_data parameter was set in the original query string in the URL your tab is loaded on. It could look like this: "https://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here". You can use that to customize the content you render if you control the generation of the link.
Well... Preventing users from adding your application to their page is impossible. You can't prevent that.
What you will be able to do is to detect who has added your application and according to that, change the content (or not display it at all). So you'll have to start with a list of "allowed" page_ids to match to the accounts you want.
Your application will receive a signed_request each time a user arrives at your application (within a page). Inside that signed_request is information not only on the user but also on the page that the application is on (provided it is a page tab app).
Once you have obtained the signed_request, it will hold a page key which contains:
A JSON object containing the page id string, the liked boolean (set to
true if the user has liked the page, false if not) and the admin
boolean (set to true if the user is an admin of the page, false if
they're not). This field is only present if your app is being loaded
within a Page Tab.
So you'll be able to access the page_id from within this variable and make a decision on the type of content you want to be displayed.
Ok, after running some tests I found out that when you add a URL as 'next' parameter to the install URL Facebook will send the admin(user) back to this URL while adding an array to the request containing all the page Id's the app was installed to.
Like this: YOUR_CALLBACK_URL?tabs_added[ID]=1
Proved to be quite easy in the end

Adsense with dynamic content

I know that this topic has been discussed before in varying extent but I have some specific queries. I will use an example for this case and would like to request you for your views.
Example:- A home finance management website. There are two pages. The basic page after login is an empty page with a text box. Type in "Rent" and rent details and trends pop up. Type in "Bills" and bill details and history pop up. The data shown to user is different of course.
Now -
1. If I place an Adsense script in the basic home page where I just have a text box, will it be disqualified for not having enough content ?
2. Even if the content changes (AJAX), does the ad change to suit the content ? Does the crawler keep a constant check of index the pages after defined intervals and whatever it finds there is kept and searched for keywords ? The same page may show different content to different users and hence have different keywords. (Also, since login would be cookie based, how does crawler see this page ?)
Edit -
I know from HERE that Google does take AJAX calls into account but since the results would be dynamically populated by accessing a database and while populating unique data, the bot looking at the form action page doesn't help much, does it?
3. Google prefers GET method. So if I go like this - xyz.com?show=rent / xyz.com?show=bills, the page is regenerated and the script reloaded but each time the crawler sniffs any one of the two pages, it might see different content for different users. What does it do ?
4. If I do not reload the page by form submission and the page is not regenerated every time, can I call a function to document.write the div I am putting the ad in ? Would that make it re-sniff the page ?
Any help is much appreciated.

How to send a Facebook page as url using the Facebook send button?

I will try to explain a bit the context for my problem.
Context:
A while ago I started working on Facebook application. One of the requirements is to be included in a Facebook page as a tab. This application will contain on a page a send button in order to be able to make it more engaging with specific people, users of the application would choose on their own. The reason behind this is because the Facebook page containing the application is related to alcohol, and "liking" the application will get more audition and potential children. Another reason for using send button rather then other similar options from Facebook (like send dialog etc.) is because in Facebook documentation was stated that send button works on mobile devices and other options don't.
Problem:
My problem is related to the send button. What I need is to be able to completely configure the send button: url, image, title, description. I have research the open graph tags in order to be able to do this. Everything works fine if the page I want to be sent with the message is a website OUTSIDE Facebook. Once I started to use the url of a Facebook page (let's call it www.facebook.com/mycustompage), then the crawler takes the images, title, description from facebook.com ignoring the actual page and the produced message is not what I want.
I have searched a lot to better understand this limitation and could not find anything relevant.
The only article I could find as a potential solution was (and even this I had trouble finding):
Send button returning error codes, like button works fine
The above discussion is a workaround which I have already put in place but is not 100% what I want. The described workaround is about putting in the send button:
<div class="fb-send" data-href="http://www.mycustomdomain.com/og"></div>
a page that sniffs the user agent. In case the user agent is Facebook crawler to serve an html empty page just with the open graph tags, otherwise redirect to the desired URL - which in our case is the facebook page www.facebook.com/mycustompage.
The message produced contains:
the title which is a link to www.mycustomdomain.com/og which when
clicked opens a page in a new tab with the address
www.facebook.com/mycustompage - this is relatively ok
under the title I have a "sub-title" readonly text containing the domain of the link: www.mycustomdomain.com - THIS IS NOT OK since I don't want to share where I have hosted the application.
the image and the desired description - this is ok.
Conclusion:
What I want to know if there is a better way to do this rather than this workaround.
If not I would like to know how I can hide for the produced message the "sub-title" so that the hosted domain is not visible.

Facebook app: Random quotes not refreshing on each page load

I have a Facebook app written in php that will display random quotes on your profile.
The box does not appear to update, it looks like it did when it was originally added.
I want to update the profile boxes on each page load (refresh), and not by a user action like clicking a link.
Any idea what is the problem and how to solve it?
This is how I did it for The Office Quotes application:
Put the random quote inside an image (many options to do this in PHP, I used the GD and Image Functions at http://us2.php.net/manual/en/ref.image.php to create a JPG containing the quote).
Accessing this dynamic image in a browser gives you a different random quote each time you refresh.
On the Facebook profile box or tab, simply link this image.
However, Facebook caches the image the first time it's loaded, so it never updates!
To force Facebook to update, you must update Facebook's image cache for the image's URL using the API function fbml.refreshImgSrc which is now accessed via the URL http://api.facebook.com/methods/fbml.refreshImgSrc and requires the access_token parameter like all other API requests. There was an announcement some time ago that this function was being deprecated, but the decision was reversed!
Setup the cache refresh code to run regularly. You can do this on a scheduled task (i.e. a cron job) or on each pageview in the application, or any other way you can think of that will cause the method to be run with the relative frequency the image will be requested by a user.
I also linked the image in the profile to a page in the app that would continually reload a new random image. Users generally would click to this page (which would refresh the image cache on each load) and they get the illusion that the image updates constantly.
Another illusion that I like even better is to add a 'Refresh' link in the profile box/tab that links to a script that refreshes the image cache and immediately returns to the user's profile, so that it actually appears to just be refreshing the profile box/tab.
Enjoy!
Profile content is cached by Facebook and does not connect to your server on every page load. This has always worked like this. No javascript runs on load/automatically, so you can't have a new quote displayed on page load.
What you can do is put a bunch of quotes in the profile content and us the fb:random tag to display a random quote on page load from the random option list. Periodically you can run a script to update the set of quotes in the user profile. If quotes are not unique to each user, you should use fb:ref handles so you just have to update the handle content, not each user's profile. Just put the ref handle in the user's profile.
I'm confused. Profiles boxes are all but gone. You shouldn't be developing anything for a profile box right now - it's just gonna disappear any day now anyway.
And even when profile boxes were still a suggested integration point, you couldn't update them in the way you are wanting to.