Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At the command line I can load websites like this:

firefox.exe google.com

However, what I am trying to load is the following:

javascript:q=document.getSelection();d='U';c=document.characterSet;if(c=='Shift_JIS')d='S';if(c=='EUC-JP')d='D';if(!q){void(q=prompt('Enter%20text%20to%20search%20using%20WWWJDIC%20(Japanese).',''))};if(q)location.href='http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?1M'+d+'J'+q

This will load if I paste it in the address bar of firefox, but it will not load if I specify it as an argument from the command line. How can I make it load from the command line?

share|improve this question
    
At least in windows, the problem is made more complicated by the fact that both the 'run' command and shortcuts limit the number of characters allowed to less than the code you want to run takes. –  Emil Jun 27 '10 at 13:27
    
As the answer hasn't been accepted yet, did my solution work? –  Tom Wijsman Jul 16 '10 at 0:39
    
It didn't work. –  Phenom Jul 16 '10 at 13:18
    
It works for me, either the mistake is with encapsulation or you're trying to do too much. Which brings me to the question: What are you trying to do? –  Tom Wijsman Aug 10 '10 at 15:20
    
If it works for you then you should know what it does. –  Phenom Aug 10 '10 at 18:43

2 Answers 2

Encapsulating it with double quotes works for me:

firefox "javascript:alert('Hello World')"
share|improve this answer

From HowTo: Run Firefox From The Command Line:

You can use command line as follows with special arguments to start Mozilla Firefox.

To open the browser, enter:

firefox

OR

/usr/bin/firefox

Firefox Open URL

To open URL in a new tab, enter:

/usr/bin/firefox -new-window http://www.cyberciti.biz/

To open URL in a new window, enter:

/usr/bin/firefox www.cyberciti.biz

Firefox Search option

You can search words (term) with your default search engine, enter:

/usr/bin/firefox -search "term"
/usr/bin/firefox -search "linux add user to group"

Open Firefox Options / Preferences

To open Firefox options/preferences window, enter:

/usr/bin/firefox -preferences

Set Firefox As Default Browser

To set the Firefox app as the default browser, enter:

/usr/bin/firefox -setDefaultBrowser
share|improve this answer
3  
Next time, please don't just copy and paste content from other sites. Link to them, and quote everything you didn't write yourself. Thank you. Plus, you're not really answering the question – this is not what the OP wanted. –  slhck Jul 16 '12 at 22:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.