Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Doesn't display any linked css #1

Closed
smlombardi opened this issue Apr 18, 2014 · 20 comments
Closed

Doesn't display any linked css #1

smlombardi opened this issue Apr 18, 2014 · 20 comments

Comments

@smlombardi
Copy link

atom .089

css files linked do not affect preview. preview document is plain html.

@f
Copy link

f commented Apr 18, 2014

Are you using relative links? Can you try absolute ones?

@smlombardi
Copy link
Author

i can’t in this case, I was working with a local file. it looks like remote ones from a CDN are working, though.

On Apr 18, 2014, at 7:26 PM, Fatih Kadir AKIN notifications@github.com wrote:

Are you using relative links? Can you try absolute ones?


Reply to this email directly or view it on GitHub.

@f
Copy link

f commented Apr 18, 2014

Ok, I will work on it 👍

@wayneseymour
Copy link

👍

@Jorval
Copy link

Jorval commented May 7, 2014

Have the same Problem, worked from a local directory with a css file in it and linked in the html.
css is ignored.
[ Manjaro, Atom 0.94, Html Preview 0.1.3 ]

@azhang
Copy link

azhang commented May 10, 2014

Yup me too. Atom 0.94. Working for remote css but not local css.

@Red5d
Copy link

Red5d commented May 30, 2014

Same issue. Local included css/js doesn't work. (Atom 0.100)

@ownadi
Copy link

ownadi commented Jun 7, 2014

Same problem here. Does not load images/css.

@alexphelps
Copy link

Same here, no local css.

@sethfri
Copy link

sethfri commented Jul 20, 2014

Same issue, Atom 0.115. Is any fix coming for this soon?

@kwaak
Copy link

kwaak commented Jul 21, 2014

After some tinkering I did get local stylesheets and script files to work.

I had to set the sandbox attribute on the IFRAME, and the way source is set.
I used a local filepath as SRC attribute, instead of the data:text/html;charset=utf8, ....

In the package source file atom-html-preview-view.coffee I changed the line

iframe.src = "data:text/html;charset=utf-8,#{encodeURI(text)}"

to

iframe.setAttribute("sandbox", "allow-scripts allow-same-origin")
iframe.src = @getPath()

Changing the source package yourself is pretty easy, while we wait for a update :-)

This pull electron/electron#208 has more info.

@jorng
Copy link

jorng commented Aug 19, 2014

I can confirm that @kwaak 's resolution appears to be working. I will continue using it to verify.

@kentonscode
Copy link

I just used @kwaak suggestion and it works perfectly! Thanks! Now preview shows html+css.

@rixbeck
Copy link

rixbeck commented Dec 8, 2014

Thanks @kwaak. It works now like a charm.

@AlexanderMike
Copy link

@kwaak solved similar problem I had with images not displaying

@tirithen
Copy link

Thanks @kwaak it works now, any way to have this implemented in the package as well?

@WebMatt83
Copy link

@kwaak 's solution isn't working for me. Any suggestions?

@Ajedi32
Copy link

Ajedi32 commented Feb 5, 2015

This doesn't work for me. CSS isn't showing up in Atom, but works fine in Chrome. My link tag is in the html document header and looks like this: <link rel="stylesheet" href="./assets/css/default.css">

@symsmith
Copy link

Works so great, thanks!

@benen89
Copy link

benen89 commented Jan 30, 2018

@kwaak please explain in more details how to fix the issue, Sorry, I'm a beginner so I didn't get what exactly should I do to make Atom Preview read css commends as well. really-Really rely on your help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests