stylish icon indicating copy to clipboard operation
stylish copied to clipboard

Styles not applied on first pageload?

Open remcokalf opened this issue 8 years ago • 4 comments

I have several websites with custom styles, e.g. for setting ad containers to display: none.

The CSS works fine, but is not applied on first page load. On a refresh of a page, the styles work. Also on a toggle within the menu bar button.

Using Safari 11.0.2 on macOS 10.13.2

remcokalf avatar Jan 08 '18 19:01 remcokalf

Hello! Can you please attach your style here and websites urls?

350d avatar Jan 08 '18 19:01 350d

I have this happening with several sites. One example:

https://www.nu.nl

The styles in this case hide all the ads by setting containers to display: none. Also see attached screenshot.

First page load: all ads visible, CSS not applied. Reload, or apply styles through Stylish button: CSS is applied: styles gone.

#header {display: none !important;} #content_container {margin-top: 10px !important;} .block.cts {display: none !important;} embed {display: none !important;} .section-advertorial {display: none !important;} .advertoriallist {display: none !important;} .nu-blendle-widget {display: none !important;} .consent-bar-show-large, #sanoma-consent-bar-mobile {display: none !important;} html {margin-top: 0 !important;} .stickyads-overlay {display: none !important;} #stage, #Stage, #stage *, #Stage * { display: none !important;} #billboardContainer { display: none !important;} .adblock_h { min-height:30px !important; height:30px !important;} .adblock_h *, #adblock_v * { display:none !important;} .adblock_noborder, #adblock_v, .adblock_m { display:none !important;} iframe { display:none !important;} div[id^=scr_] { display:none !important;} .wtf-advertorial { display:none !important;} #eyeDiv {display: none !important;} #pageheader {min-height: 0 !important;} #pageheader, #webring .inner-content {min-height:60px !important; max-height: 60px !important;} object {display:none !important;} #webring .inner-content div{ display:none !important;} .block.cts {display:none !important;} body {background-image: none !important;} .section.adblue {display: none;} .section.advertorialwidget {display: none;}

schermafbeelding 2018-01-09 om 10 38 10

remcokalf avatar Jan 09 '18 09:01 remcokalf

What version of Stylish you using here? Works fine in my build, can you test? #37

350d avatar Jan 19 '18 06:01 350d

I am using: Stylish 2.0.8 Safari 11.02(build 13604.4.7.1.6) on macOS 10.13.2

I also tried your 2.0.9 beta from the #37 thread, but it does the same.

I checked the source code of the page for what is happening. What I see is happening (with 2.09 installed), is that the custom styles are inserted near the bottom of the main html and near the bottom of every iframe.

On first pageload though, the insertion near the bottom of the main html is not there (the insertions in iframes are there). Only after a refresh, the insertion near the bottom is there, and styles are applied.

See attached screenshot for a before and after.

image 2018-01-19 at 11 33 21 am

remcokalf avatar Jan 19 '18 10:01 remcokalf