Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

PM Stylesheet on local filesystem? WORKS!

by roboticus (Chancellor)
on Nov 17, 2010 at 23:29 UTC ( #872091=monkdiscuss: print w/replies, xml ) Need Help??

UPDATE: I finally figured it out (or rather, after sufficient googling, experimenting and such, I stumbled across Links to Local Pages Don't Work). Here's the deal: I'm using Firefox and NoScript. It turns out that the file: URI scheme is blocked as a security measure, to prevent rogue pages from executing local files on your computer. So, to make it work, I just do this:

  • Mark PM as a 'Trusted' site in NoScript
  • Tell NoScript to allow a local link. You can do it via Options | Advanced | Trusted | Allow local links.
Once I did that, and reloaded the page, my ugly style sheet went ahead and made PM pretty hideous. (While trying to make it work, and being sure of my inadequate CSS skills, I made some pretty fugly styles.

So if you're using FireFox and NoScript and want to do it, that's how. (For FF 3.5.15 and NoScript anyway.) The same page also gave several other possible remedies, so give the page a look if you're having troubles.

Hello, fellow Monks:

After the recent thread on updating the site, I thought I'd teach myself something about style sheets and such. So on the Display Settings screen, I tried to set the Link to External CSS stylesheet: to "file:///C:/Work/DATA/PM.css", and it didn't work. I didn't expect that it would, really, as the help screen explicitly mentions that it should be a link to another webserver. I had the hope that the docs were a little overly restrictive.

Anyway, short of putting a web server together, or glomming some space on one somewhere, is there a way to get the style sheet from my local machine? A bit of googling didn't help much, as I couldn't think of any useful terms. (I tried perlmonks style sheet "file:///", perlmonks style sheet "client filesystem" and a few other searches, but can't find anything useful.

I guess I'm really looking for a pointer to a way to do it, or a definitive "give up!" message. (In the event of the latter, I guess I'll have to find a web server I can access from work...)

Thanks in advance!


Update: I should clarify it a bit. By "didn't work" I mean that when I tweaked some junk in my stylesheet, I couldn't detect any differences on the screen. However, as I haven't started learning them, I could've simply done something wrong. So a whack with a cluestick would be appreciated if that's my problem.

Replies are listed 'Best First'.
Re: PM Stylesheet on local filesystem?
by PeterPeiGuo (Hermit) on Nov 18, 2010 at 01:34 UTC

    If you wish, you can use on site mark up. To start, use an existing theme as template, copy and paste everything from the theme's CSS.

    As an experiment, copy the entire css for the green theme, which is not long any way. Modify the background color to #faa (default is #fff), and observe.

    Peter (Guo) Pei

Re: PM Stylesheet on local filesystem?
by sundialsvc4 (Abbot) on Nov 18, 2010 at 01:38 UTC

    Don’t forget that the web-browser will request the stylesheet ... and that it will use a URL to do it, just as it requests anything and everything else that it receives.   So... the source file has to be somewhere (on the system that’s hosting the web-server) that corresponds to a URL that a web-client can issue.   And all pages, etc., must contain that URL.

    The web-client does not know, nor does it care, that the file actually resides “at such-and-such place on such-and-such drive.”

      "file:///C:/Work/DATA/PM.css" is a valid URL and a browser will request the valid "file:///C:/Work/DATA/PM.css" URL and will look for it on your local system on C drive in Work/Data/PM.css

        Thanks for the tip!

        After opening the FireFox Error console, I saw the error messages coming up, which led me to the overall solution.


Re: PM Stylesheet on local filesystem? WORKS!
by aquarium (Curate) on Nov 18, 2010 at 04:43 UTC
    as has been already stated, if the stylesheet on the PM website points to file:// uri, then it will be trying to get it from the server file system (instead of web server), which won't work. there are websites that do allow custom stylesheets, but that's old stuff anyway, as firefox and other browsers are bringing capability to override any website with your own stylesheet(s). which is what will work for PM etc. Just read up on your browser feature for overriding it has nothing to do with setting a stylesheet on your PM settings
    btw a good way to test any stylesheet is to set a 1px border for all elements. it makes all the boxmodels visible for all elements, and sure is visible.
    * { border: 1px solid red }
    the hardest line to type correctly is: stty erase ^H


      I had a hard time deciding whether to ++ this node or not.

      Clearly, the specified file: URI tells the web browser to read the file from its local hard drive, not from a remote server. But your example of a good test case for CSS is spot on (simple and obvious!). These two came up to a draw.

      Ultimately, your signature line won me over, so ++! (For some reason at work, my rxvt windows keep losing echo, usually when breaking out of a command | more pipeline, and I have to type stty echo to correct it.)


        yeah...pesky terminals. whenever i used to setup sun servers, it's a pain to type it correctly each time, before you finally get an OS and some sane terminal settings. before that setting, you can't use the backspace key, so need to type perfectly. this is on actual hardware terminal attached to server
        the new browser feature for overriding site stylesheets is implemented directly in the browser, and works perfectly/logically to override all styles on target website, whether they be css or inline html styles..and inline styles have high precedence normally. applying the styles at browser level allows to override all styles.
        try "command | less"...might work better, as "less" is more terminal aware.
        the hardest line to type correctly is: stty erase ^H
Re: PM Stylesheet on local filesystem?
by Anonymous Monk on Nov 18, 2010 at 02:31 UTC
    It works for me, that is, I get a security error in the Error Console (Ctrl+Shift+J)
    Security Error: Content at may no +t load or link to file:///C:/local.nonsense.css.
    I say its a good idea to not allow websites to access random files on my computer.

    The generic way to do this is with Greasemonkey plugin (and

    You could also do it with a bookmarklet, but that means an extra click

    javascript:(function(){ function addRawCss(styles){ var newSS; if(d +ocument.createStyleSheet){ document.createStyleSheet("javascript:'" + + styles.replace(/'/g,"\\'") + "'"); }else{ newSS=document.createEleme +nt("link"); newSS.rel="stylesheet"; newSS.href="data:text/css,"+escap +e(styles); document.documentElement.childNodes[0].appendChild(newSS); + } } addRawCss("body { color: yellow !important; background-color: bl +ack !important; }"); })()
Re: PM Stylesheet on local filesystem?
by kcott (Canon) on Nov 18, 2010 at 00:07 UTC

    If you look at the source for a PM page after adding you external stylesheet, you'll see:

    <link rel="stylesheet" href='file:///C:/Work/DATA/PM.css' type="text/c +ss" />

    So, the short answer is "give up!".

    The longer answer is that will be looking for that resource on the PM webserver, not on your PC. Ignore this - I got the client/server relationship back-to-front.

    -- Ken

      OK, I may have to give up.

      But I don't understand: why is it a problem that the page source contains that link? Doesn't that link instruct the browser to read the style sheet from the local drive? Googling about (Wikipedia, RFC 396, ...) leads me to believe that file:///C:/Work/Data is a valid URI, so I would expect that firefox would use it without complaint.

      I realize no-one else would be able to use my stylesheet, but that's not an issue for me so long as I can use it!


        I wasn't suggesting the URI was invalid - it looks fine to me.

        I also wasn't suggesting the link showing up in the page source was a problem. That was really just intended to indicate that your change had done something and was in response to what you'd written regarding "didn't work".

        I did, however, get the client/server relationship back-to-front, so my apologies for that.

        -- Ken

      The longer answer is that will be looking for that resource on the PM webserver, not on your PC.

      except that it won't, thats just silly

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://872091]
Approved by tye
Front-paged by tye
and the shadows deepen...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2017-03-28 05:37 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (327 votes). Check out past polls.