General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 08:17PM

Is there a way to temporarily disable stylesheet rendering in K-Meleon? I'm not referring to CSS ad-blocking; what I had in mind was toggling the display of all CSS elements on or off. In Firefox this is done through the main menu under View/Style/Normal and View/Style/No Style; I believe I used to see an equivalent in IE, as well.

My objective here is to test what my own pages look like without the CSS styling, just to be sure that the format isn't unreadable or even hideous :O for folks who have disabled CSS, or are using non-compatible browsers.

---
Gerry

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: JohnHell
Date: May 24, 2016 09:05PM

permissions.default.stylesheet to 2

1 to allow

3 block third party only

Directly, there is no command.

EDIT: Change the pref and reload, just in case is not obvious winking smiley



Edited 2 time(s). Last edit at 05/24/2016 09:09PM by JohnHell.

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: siria
Date: May 24, 2016 09:24PM

Yep smiling smiley
Especially useful for people with old or very slow computers, or prefering to surf with blocked javascript. Blocking CSS speeds up snail pages enourmously (when even JS block doesn't suffice yet), and sometimes it even unhides stuff that otherwise wouldn't be visible without JS.

Had badly missed this function for YEARS, and only recently learned it has existed all that time already, even in KM1.6! Kinda fell off the chair ...!! :O :O grinning smiley And of course immediately started creating a macro to get a menu...

And there are a bunch more of those handy "permissions.default.xxx" prefs, also for iframes ("subdocument"), also long since missed. Really wish there'd be a native KM user interface for them, but then again, wish this for a hundred prefs...
For occasional use one can simply toggle such a pref in about:config page.
If anyone wants to toggle very often, here some macros:

Macro "Priv3buttons" (on-off-no3rdParty) creates toolbar buttons to toggle some of those default permissions:
http://kmeleonbrowser.org/forum/read.php?9,135558

Macro "Permdefs" (stupid name, meant default permissions) toggles the same by a menu:
http://kmeleonbrowser.org/forum/read.php?9,134990,

FF Addon "ExExceptions" is a great interface for geckos native BLACK-WHITE-lists, to define certain domains as exceptions of those global permissions:
http://kmeleonbrowser.org/forum/read.php?9,124407

Macro "Blockeria" is a helper macro for mass-toggling of several global prefs at once. It's for advanced users who can put together their own groups of self-chosen prefs. Out-of-box it includes only a few prefs as *example*, by no means complete, with red, yellow and green buttons for toggling (or by menu):
http://kmeleonbrowser.org/forum/read.php?9,135209,135625#msg-135625

Those 4 I'm now using very happily all the time smiling smiley



Edited 1 time(s). Last edit at 05/24/2016 09:29PM by siria.

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 09:35PM

Quote
JohnHell
permissions.default.stylesheet to 2

1 to allow

3 block third party only

Directly, there is no command.

EDIT: Change the pref and reload, just in case is not obvious winking smiley

Thanks. It works on some sites, but not all of them. For example, it works here on this forum, some pages at Mozilla, etc. For some reason, however, it doesn't work on my own pages. Could that be due to the fact that my CSS elements are all in the page itself, instead of linked to a separate stylesheet file?

In other words, I put the rules in the heading of each HTML page, e.g.:
<head>
    <style type="text/css">
        body {background: #fff0bd; margin-top: 10px;}
        (etc.)
    </style>
</head>

I put them there because there are slight inconsistencies between the pages, so a separate CSS file can't be applied to all of them globally.

By the way, permissions.default.stylesheet did not show up in my about_config, so I had to add that manually.

---
Gerry



Edited 1 time(s). Last edit at 05/24/2016 10:33PM by foliator.

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 09:44PM

@siria (aka "MacroMaster" grinning smiley): Thanks for those links. I'm going to try your macros, esp. the menu-oriented one, since I'm starting to encounter symptoms of TOP (toolbar over-population) at this point. grinning smiley

---
Gerry

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: siria
Date: May 24, 2016 09:55PM

grinning smiley I know what you mean, there are actually a few toolbars that I switch on only when needed, for a couple minutes - especially Priv3buttons.

Your assumption is right about blocking external files only:

http://kb.mozillazine.org/Hostperm.1
Quote

it deals only with loading files, not with inline tags. As a result, rules will not affect inline styles, inline scripts, or DOM event scripts, to name a few common examples. Tags with a src= attribute are affected, because the src attribute specifies an external file to load (which is therefore controlled by nsIContentPolicy).


Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: JohnHell
Date: May 24, 2016 10:14PM

Quote
foliator
Quote
JohnHell
permissions.default.stylesheet to 2

1 to allow

3 block third party only

Directly, there is no command.

EDIT: Change the pref and reload, just in case is not obvious winking smiley

Thanks. It works on some sites, but not all of them. For example, it works here on this forum, some pages at Mozilla, etc. For some reason, however, it doesn't work on my own pages. Could that be due to the fact that my CSS elements are all in the page itself, instead of linked to a separate stylesheet file?

In other words, I put the rules in the heading of each HTML page, e.g.:
<head>
    <style "type=text/css">
        body {background: #fff0bd; margin-top: 10px;}
        (etc.)
    </style>
</head>

I put them there because there are slight inconsistencies between the pages, so a separate CSS file can't be applied to all of them globally.


Uhm, yes, local files (file:///) aren't affected by permissions. Neither inline CSS (<style>), only external resources (<link>).


Using external CSS, you could apply different classes to each page body (following the example above).

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 10:31PM

Quote
siria
grinning smiley I know what you mean, there are actually a few toolbars that I switch on only when needed, for a couple minutes - especially Priv3buttons.

Your assumption is right about blocking external files only:

http://kb.mozillazine.org/Hostperm.1
Quote

it deals only with loading files, not with inline tags. As a result, rules will not affect inline styles, inline scripts, or DOM event scripts, to name a few common examples. Tags with a src= attribute are affected, because the src attribute specifies an external file to load (which is therefore controlled by nsIContentPolicy).

Yes, I just moved my stylesheet rules to an external CSS file and tried your permdef.kmm (with everything but the stylesheet part commented out, as that was all I needed) and it works perfectly. Oddly enough, the View/Style/No style option in Firefox blocks my inline rules, as well, but I don't know how Mozilla does that; it's likely hardcoded, anyway.

What I will probably do now is create a keyboard shortcut in accel.cfg to call up that macro, even though it's already accessible in my Privacy menu. In fact, if I'm really ambitious, I'll create another macro which runs the commands in yours, but also reloads the page after I've made my selection.

Is there a cure for KM addiction? smiling smiley

---
Gerry

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 10:46PM

Quote
JohnHell
Using external CSS, you could apply different classes to each page body (following the example above).

True; they could in fact all be defined in that same CSS file (such as body.1, body.2, etc.) as long as there are not too many HTML pages that differ, otherwise I'd be looking at an awful lot of additional classes that have to be referenced in each HTML page.

Alternatively, I could simply assign a different external CSS file for each page, e.g. page1.css, page2.css, etc., using the same class names, but with different values.

Lots of work in either case. I haven't put all those pages up yet, anyway. Right now my site is just a single HTML page with an external CSS file.

---
Gerry

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: siria
Date: May 24, 2016 11:17PM

Would just leave them inside as is smiling smiley
Personally when I'm blocking styles, it's either to reduce giant page loads or trying to get a wider layout etc., but blocking such little inline styles would only make the page worse, not better, so why.

Quote
foliator
What I will probably do now is create a keyboard shortcut in accel.cfg to call up that macro, even though it's already accessible in my Privacy menu. In fact, if I'm really ambitious, I'll create another macro which runs the commands in yours, but also reloads the page after I've made my selection.

Have fun grinning smiley
By the way, ever tried mouse gestures? :cool:
One of those things I never needed until trying it, and then never looked back!
For example just a tiny reflex flicker with the mouse hand and the page reloads smiling smiley

Quote
foliator
Is there a cure for KM addiction? smiling smiley
Yes. KM bugs (GRRRR! Mainly while macro-writing). But the healing is only temporary tongue sticking out smiley



Edited 1 time(s). Last edit at 05/24/2016 11:18PM by siria.

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 11:29PM

@siria: Well, here's what I've ended up with, ToggleCSS.kmm (a macro calling a macro):

ToggleCSS{
macros(permdef_ToggleStyles)
id(ID_NAV_RELOAD);
}

I've assigned ALT S to that in accel.cfg, and it works just great! Now that you mention it, there was no need to modify your macro to accomplish that, but I wanted to hide the other items from the Privacy menu, which is busy enough already. smiling smiley

The only drawback to adding that reload command is that it erases the message on the status bar, but that's alright, since I can judge the status from the appearance of the web pages. Some of them look horrific without CSS! :O Mine is still quite readable, however. smiling smiley

---
Gerry



Edited 1 time(s). Last edit at 05/24/2016 11:31PM by foliator.

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 24, 2016 11:41PM

Quote
siria
By the way, ever tried mouse gestures? :cool:
One of those things I never needed until trying it, and then never looked back!
For example just a tiny reflex flicker with the mouse hand and the page reloads smiling smiley

In my case that's risky, as I have an overly-sensitive touchpad built into this Logitech wireless keyboard, and Logitech offers no software adjustment for that. The keyboard doesn't come with its own drivers; it uses the system's keyboard and mouse drivers. I even had to use a 3rd-party utility to eliminate pinch zoom, which is a system-wide default and was forever messing up my desktop. One false move and the icons would grow to twice their size, changing their positions at the same time. :mad:

---
Gerry

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: siria
Date: May 25, 2016 12:20AM

Hihi, had just meant to leave your *site* as is smiling smiley
It's perfectly fine and great that you can customize KM to your personal needs now, that's exactly why we love it! Oh yes, menus also tend to suffer from MOP - menu-over-population... Telling a macro-writer, and lousy at cleaning up :cool:

Ah pity about the touchpad. No idea how right-click gestures would work there, if at all.

Options: ReplyQuote
Re: How to disable CSS rendering?
Posted by: foliator
Date: May 25, 2016 01:45AM

Quote
siria
Ah pity about the touchpad. No idea how right-click gestures would work there, if at all.

By default, tapping the touchpad with two adjacent fingers functions as a right-click. The scroll wheel function is simulated by dragging with two fingers. KM's mouse gestures feature could easily conflict with these two-finger gestures, which can't be disabled.

I'm keyboard-oriented, anyway, and pretty good at remembering the shortcuts, but in case I forget, there's my long list of custom keyboard shortcuts, which I can call up with the hotlink Ctrl 0. I made a toolbar button for that, as well. There are some key combinations I can't assign in any app, because they are already assigned to desktop shortcuts, which are global and will override those in the apps.

---
Gerry



Edited 1 time(s). Last edit at 05/25/2016 01:46AM by foliator.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.