Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

What's a simple way to launch a browser on an server that doesn't have a GUI, but needs a GUI-like browser? Something like Firefox or Chrome. I need to trigger a page load but it needs full javascript support. Once the page is loaded it can close out. But otherwise I have no need for a full graphical interface.

share|improve this question

marked as duplicate by Gilles, slm, Renan, vonbrand, jasonwryan May 11 '13 at 5:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Is X forwarding an option? This executes the browser on the server but displays it on a different machine. – Marco May 10 '13 at 9:13

2 Answers 2

up vote 10 down vote accepted

There are two options I can recommend here:

First, if you want to literally launch a full graphical browser and have it load a page with on a machine with no graphical capabilities, there is a tool called xvfb that will let you run a complete X server with no physical display associated with it. You then just need to run firefox with that X server set as the DISPLAY environment variable, and pass the URL you want to open as an argument on the command line. There is a comprehensive tutorial here, geared specifically towards doing this in an automated testing setting.

For your use case, however, it might be simpler to leverage phantom.js, which is a full webkit implementation designed specifically to run in a headless/non-graphical environment and offering a javascript API.

share|improve this answer

cmekendry's answer is probably the right one for you since you need javascript support - in any other case it could be easier to use lynx. Lynx is a text-based web browser that can run in a terminal or over ssh.

share|improve this answer

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