1

As the title says, I want to run a piece of javascript whenever firefox starts.

My actual problem is that the firefox window always opens at 0,0 in the screen. I am on a debian system, with dwm as my window manager. I can successfully change the size of new firefox windows (by passing in the -geometry commandline options), but all attempts to coax it to remember its location have failed.

What works is the following bookmarklet:

javascript:window.moveTo (32, 32);

So now, my problem could be resolved if I could get this piece of javascript to run everytime firefox starts. I've tried putting it in user.js (without the 'javascript:'), but to no avail.

0

3 Answers 3

2

What happens if you set it as your home page?

5
  • that works (and the deserving upvote given), but doing it this way means that I'll lose the ability to restore my session. See my own answer for a less hackish way, but as a quick and dirty solution, this was nice :)
    – Manav
    Aug 1, 2011 at 15:08
  • 1
    looks like I cannot answer my own question for the next 3 hours, so till then here's the keyword: userChrome.js
    – Manav
    Aug 1, 2011 at 15:13
  • @KnickerKicker, what does your homepage have to do with restoring a session?
    – Synetech
    Aug 2, 2011 at 2:58
  • @Synetech - the browser will be automatically repositioned only when the browser is set to open the home page by default when it runs. It is an mutually exclusive option: either I set firefox to open the home page, or restore the previous session.
    – Manav
    Aug 5, 2011 at 7:54
  • Oh, so you’re using a built-in session restore function. Okay, I see. Have you considered using an extension instead (which would provide much more functionality)?
    – Synetech
    Aug 6, 2011 at 1:57
1

download the userChrome.js extension now, enter the following line into /chrome/userChrome.js

window.moveTo (32, 32);

and you're done

0

Try creating a new home page (a HTML) and put it there, between <script> tags.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .