1

Is there a way to execute some javascript on load a web site. For example I want to hide facebook chat and I want to execute document.getElementById('pagelet_chat_home').style.display = "none" on loading a site.

1 Answer 1

4

You could wrap the needed actions into a greasmonkey script - Chrome supports greasemonkey user scripts out of the box and converts them into a plugins automatically.

Save the following as script.user.js and open it with Chrome. Chrome should detect it as a plugin and install it. Didn't check if it actually works but there shouldn't be any problems.

// ==UserScript==
// @name          Hide Pagelet
// @namespace     hide_pagelet
// @description   An example Greasemonkey script that hides a pagelet
// @include       http://*.facebook.com/*
// ==/UserScript==

document.getElementById('pagelet_chat_home').style.display = "none";
Sign up to request clarification or add additional context in comments.

2 Comments

thanks. And what about other browsers ( IE, Firefox ). Are they support greasmonkey script or can use other ways.
Firefox supports Greasemonkey scripts through a plugin. en.wikipedia.org/wiki/Greasemonkey

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.