2

I am trying to develop a display device (expected to be installed in public transports) which is able to show a (more or less fixed) web page in a chromeless embedded browser on a Linux platform (I am currently using Archlinux).

After a lot of tries with Mozilla Firefox, I am now focusing on the use of a small XULRunner application using the following very simple xul document:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="EPL Browser" width="1920" height="1080" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 <browser type="content" src="http://www.example.org//" flex="1"/>
</window>

This works nearly as expected, but now I also want to apply to this page (whatever web page I choose) a CSS rule for removing unwanted scrollbars, like the following:

body {
    overflow: hidden;
}

When I was using Mozilla Firefox, this was very simple, I just needed to put it in a chrome/userContent.css file inside the Firefox profile.

But now I would like to know:

  • Is there any mean to include my userContent.css file in my xul document in order to have it working the same way as in Firefox?
  • If not, is there another way to apply this same CSS rule (and possibly others) to the page that I defined in the xul "browser" tag? For example by some other tags directly included in the xul document?

Any help would be welcome.

GingkoFr
  • 72
  • 5

1 Answers1

1

Use of the userContent.css file is in the nsLayoutStyleSheetCache.cpp file https://dxr.mozilla.org/mozilla-central/source/layout/style/nsLayoutStylesheetCache.cpp#314-341

Which looks like it is not Firefox specific, the app needs to not be safe mode, and there needs to be a profile used, otherwise I think you should be able to use this files.

erikvold
  • 15,988
  • 11
  • 54
  • 98
  • I'm not sure if I understand you very well… Are you telling me that I could actually set it in a Firefox profile (meaning, on Linux, in `$HOME/.mozilla/firefox...` directory) the same way as if I had used Firefox directly? – GingkoFr Jun 10 '15 at 21:59
  • Ok, this seems to work. The key is finding where is the XULRunner profile actually located. I found that the actual place is specified into the `application.ini` XULRunner starting file, into the `[App]` section and under the `Profile` key, with (on Linux) a dot added on the front of the name if there is no one. So if you write `Profile=xul_custom`, the profile will go into `$HOME/.xul_custom`. If the Profile key is missing, the `Vendor` and `Name` keys are used. So if `Vendor=mozilla` and `Name=firefox`, it will actually go into `$HOME/.mozilla/firefox`... – GingkoFr Jun 15 '15 at 08:29