CSS loaded but not applied - html

Sorry if I repeat, but I couldn't find the answer. This is my website: http://www.stolems.com/pl
My problem is that files css loaded but doesn't applied. I tried in FF, Chrome, Safari and still nothing. But when I load style in tag style it works. What can I do? I noticed that my files css are mime type text/html it should be text/css?
Besides I loaded at this site admin dashboard and template. Admin dashboard works, template not..

Your server is serving .css files with MIME type text/html. It should be text/css. Just tell your server administrator and they will fix it for you.
If you see the console in chrome, it says:
Resource interpreted as Stylesheet but transferred with MIME type text/html.
And in firefox:
The stylesheet was not loaded because its MIME type, "text/html", is not "text/css".
This happened for your .js files too.

if you are using a .htaccess and you have rewriteRules inside the .htaccess then take a good look if you did not forgot to notify the end of the string using a $, if you forget to notify the end of a string most of the mime types get fuzzled up.

Related

css not working in wamp server

I have a problem with external css. When I have creating my project using html and css the css is working fine but when for some reasons I have change this
#LoadModule rewrite_module modules/mod_rewrite.so
in httpd.conf file in apache
to this
LoadModule rewrite_module modules/mod_rewrite.so
my all the css are not working properly and one more thing is that when I have checked the console
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/E-commerce/styles/style.css".
anybody tell me that this is the main reason or not
A Simple description to whats happening during the process is that browser Send HTTP Request and receive a response to that request from the server to two contains headers.in this case your server is making stylesheet come with wrong content-type try first to inspect element using dev tools in browser and investigate the response from server .
i believe if you create new htaccess with the following content :
AddType text/css .css
this will tell server to send it as stylesheet
Many times when your css file is large so your browser stores it in cache and hence not every time it renders your css file when updated in editor and reloaded the site.
To rectify this simply press Ctrl+F5.
This will clear the browser cache for that tab(that website) and reload the page forcing the browser to render the updated css.
This should work without touching your .htaccess file.
EDIT: For Mac if you are using safari, the sortcut is Command+Alt+E
In Mac if you are using Chrome, Ctrl+F5 will not work, so refer to this site: https://clear-my-cache.com/en/apple-mac-os/google-chrome.html
Use ctrl + F5 to clear browser caches on window.
This should work.

resource interpreted as document but transferred with mime type application/octet-stream pdf

Don't know why I'm facing this issue not able to download pdf files in chrome browser, it is showing below error in Nginx server.
resource interpreted as document but transferred with mime type application/octet-stream pdf
Though I have included mime type as application/pdf
If it's just a warning then simply ignore it! It's just Chrome.
If not, try to include MIME Type as application/octet-stream.
try to use those examples in your code.
PDFobject
this is a classic one:
if you can load localhost:8080/xyz123/PdfFile.pdf
then write like this:
<iframe src="./xyz123/PdfFile.pdf" title="title">
...
</iframe>
Similar issue came up for me only for .pdf files. I changed the Application Pool's idenity to Network Service and it fixed the issue.
I am not sure why it worked as the response header still had the same Content-Type, but it worked.

appcache served as text/plain only works in chrome?

I'm working on an application that has a broken manifest file. It's broken in a bunch of ways.
One of the ways that it's broken is that it is being served as type text/plain.
Safari and Firefox ignore it because of this. None of Safari, Firefox, or Chrome show the manifest file being downloaded in firebug/inspector. Safari does show an error in its console about the incorrect mime type.
Only Chrome accepts the manifest file and creates an application cache. (This, of course, causes the application to break horribly, because the manifest's contents are wrong...)
I was under the impression that any manifest served with an incorrect mime type would be ignored.
Should manifests served as mime type text/plain be ignored? Is this a known bug in Chrome?
According to the specification a manifest must be served with mime-type text/cache-manifest.
If a browser interprets a manifest without that mime-type just because it was referenced in <html manifest="xxx"> it's not following the specification for 100%. But in my opinion: that's not a bug, it's a feature! :D
Aside that, why referencing a manifest without the correct mime-type anyway (instead of not referencing one at all)?
This, of course, causes the application to break horribly, because the manifest's contents are wrong...
Reading that I would assume that you just want to clean the appcache of Users already loaded the missconfigured manifest? If that's your intention so try it on the way described there: Removing HTML5 Appcache Manifest, Permanently

How to force mime-type of file download

When users visit our website's download page, it automatically starts the download. The page has a display:hidden iframe with src pointing to the installer file
<iframe src="/path/to/installer.dmg"></iframe>
This works fine so far. But my Chrome extension: "Web developer" logs this Warning message
Resource interpreted as Document but transferred with MIME type application/octet-stream
So, is there a way to explicitly declare installer.dmg's content-type as octet-stream, so that browsers do not get confused?
As one of the previous answers references a broken link I will give my answer here.
If you are trying to specify the mime type of files with a certain extension you can add this to .htaccess:
AddType application/octet-stream .dmg
However, this will not guarantee that browsers will 'download' the file. Chrome for example does not recognise this. So here is a way to force files of a certain type to 'download':
<FilesMatch "\.(?i:dmg)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
The little bit of regex around the extension (dmg) is just there to make it case insensitive.
You might need to clear browser cache before it works correctly.
This works in the latest Chrome, Firefox and IE8 (as of August 2013). I have not tested in the latest IE or Safari, so if someone has those browsers and can test them, please confirm they work in the comments below.
Insert those lines in your vhost configuration, inside a docroot directory:
<Directory path/of/your/docroot/directory>
<Files path/of/your/file>
Header set Content-type "mime/type"
</Files>
</Directory>
This page has what you need, if your web server is Apache. Basically what you do is tell apache that any file with a .dmg extension has the mime-type of application/octet-stream.
The problem is that you are using an installer file as a web page
what you can do is open the installer page in a popup on document ready
you can read this (with jquery): http://choosedaily.com/1178/15-jquery-popup-modal-dialog-plugins-tutorials/
or this(no jquery): http://www.quirksmode.org/js/popup.html

Preventing playing an MP3 file using an HTML anchor

How do you make an MP3 link download instead of play "in-browser"?
I tried changing the target to blank, but that just opened the player in a new window.
You can't do this by modifying the link. You will have to have the HTTP server that serves the file send a Content-Type of "application/octet-stream". Presumably it is sending the type "audio/mpeg", which is hinting to the browser that it is MP3 content. Without the capacity to alter this header, you can't achieve this.
If your server supports PHP, create a PHP script called "getfile.php" (or similar) that takes a parameter of a file ID or file name. Set the content-type and content-disposition headers within the script to force a download prompt.
See: http://webdesign.about.com/od/php/ht/force_download.htm
Lots of solutions here. Here's the basic idea:
Use Javascript to make a (ajax) request to the server
When the request is received, run a script
This script redirects your browser temporarily to a new page
The new page has a few headers telling your browser to expect a file attachment, and what kind of attachment it is
The "save as" dialog pops up and your original page is still onscreen
I could be wrong, but I've seen people with the same problem before just with other file types, they used the code below:
<FilesMatch "\.(?i:mp3)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
Hope this works for you!
For quite some time (Chrome 14+, Firefox 20+, Edge 44+) it is possible to use the download attribute on same-origin links to force download behavior even when the server doesn't supply a Content-Disposition header on the link target.
Without access to the server generating the HTTP responses, the browser gets to decide what to do with different types of responses. usually the only files a browser will download are things like .zip files which it cannot display.