Live data from Hacker News

Headless mode in Firefox

developer.mozilla.org

61–70 of 191 posts

Re: Headless mode in Firefox

#62

For all of you old fogies working on angular 1 apps and are running browser tests with karma you can run your tests in firefox with headless mode with a customer launcher. Add the snippet below to your karma conf ``` browsers: ['FirefoxHeadless'], customLaunchers: { FirefoxHeadless: { base: 'Firefox', flags: [ '-headless', ], }, }, ``` Note you need to be running the beta version of firefox, I needed to download it f…

Does this offer any real benefit over Xvfb?

Works on Windows.

Re: Headless mode in Firefox

#63
post #17

Earlier quoted context omitted.

You can generate pdfs with headless Chromium/Chrome pretty easily[1]. chromium-browser --headless --disable-gpu --print-to-pdf=output_file_name.pdf file:///path/to/your/html [1] https://developers.google.com/web/updates/2017/04/headless-c...

Wow - thanks for posting that: could come in handy on the project I'm currently working on!

We're using Chrome Headless inside Docker to produce thousands of PDF reports from an Angular/D3 web app.

It works very well, but there are some gotchas with regard to the Chrome Remoting Interface.

Re: Headless mode in Firefox

#65
post #23
post #5

Earlier quoted context omitted.

From a security POV, the URL being displayed at all times is absolutely necessary in order to avoid phishing.

No it isn't, the URL is unreliable source of truth with Unicode spoofing attacks and things like that. Safari only shows the domain at this point; the URL is an unimportant implementation detail.

How would you differentiate say: "http://googlemail.buyviagra.com"

From: "https://mail.google.com"

If they looked the same.

Re: Headless mode in Firefox

#67
post #34
post #6

Can you tell Firefox to print in headless mode? I want to write reports using HTML and JS, but printing is always an issue.

Remember that if you pass through any data from an outside source, you're running their code on your browser when you thought you were just printing a document. The security issues don't apply in all circumstances, of course, but if you feel like taking a shortcut to PDF generation and printing through a headless browser, you need to keep them in mind.

I highly recommend that anyone using a headless browser that may access outside sources employ something like this to run the headless browser in an external environment, in this case AWS Lambda: https://github.com/justengland/phantom-lambda-template

I used this approach for a project at a previous company and not only did it keep the potentially unsafe external code execution isolated from the rest of the stack, but it also proved to be fantastically scalable because of the ability to have AWS Lambda running many headless browsers in parallel compared to trying to scale something like this out on your own hardware.

Re: Headless mode in Firefox

#69

It would be cool if mozilla and google would standatalize the headless API and command line flags as llvm and gcc has done, so you would perform headless cross browser testing.

FWIW, the most common cc command line flags on unix share a common lineage back to AT&T PCC compiler.

Which is not to say there is not common effort between the projects you mention now.

Post reply on HN