This is my first hack at writing a Chrome extension. I want it to execute some pretty simple JavaScript every time a Facebook page loads. It’s doing everything I want except that for some reason, it only runs my script if I hit the Refresh button. If, e.g. I clicked on the Facebook logo, or I go to a status from my notifications, the script doesn’t run… until I click refresh.
Here is my manifest:
{
"name": "Anti-social Reader",
"version": "1.0",
"description": "Defeats 'social reader' apps on Facebook, by letting you just see the news story directly without installing the app.",
"content_scripts": [
{
"matches": ["http://*.facebook.com/*", "https://*.facebook.com/*"],
"js": ["kill_social_reader.js"],
"run_at": "document_end",
"all_frames": true
}
]
}
I need it to wait until document_end because it is modifying the DOM of the loaded page. I’m sure it’s something stupid… any ideas?
In an obvious way it is not possible. The facebook page is making numerous ajax calls, hence the page does not reload completely. What you need here is to identify whether a ajax call response has been received by the browser or not? and then triggering the event required. I can’t comment on that part as I’m still a newbie in that respect.