Hi All
Is there a way of hiding the CSS from users so that they cannot see
it when selecting View Source?
Thanks
Hi All
Is there a way of hiding the CSS from users so that they cannot see
it when selecting View Source?
Thanks
euhm,
You could use an external CSS file, but if they view the source of that file they will see it too.
I’m using an external CSS file.
<link href=“css/login_form.css” rel=“stylesheet” type=“text/css”>
Is there another way?
You could use AJAX to get the CSS for certain parts of the page
(I’ve never tried that, but it should be possible)
Could you tell us why exactly they can’t see the content…
If it’s publicly available on the web, a determined enough user can and will find it, and there’s nothing you can do to stop them.
You are wasting your time trying, as with trying to hide markup.
The only way to hide anything in web page source is to not send it to the browser at all. If it goes to the browser then your visitor can view it. If you encode it before sending it to their browser then their browser needs to be able to decode it in order to use it and they will be able to see the decoded version.
There is now possible way to hide it but I’m wondering, why you wanna do it? Just being curious here.
Sometimes when I view the source of my web pages I can see the CSS and sometimes I only get the link to the external CSS file. I wondered what goverened this exposure as it does not seem to follow any pattern.
Whether the person who created the web page jumbled the CSS in with the HTML or whether they put it in a separate file and linked to it.
Using a separate file doesn’t prevent you viewing the CSS, you just have to open that file to see it.
All of my CSS is in a seperate file and a link set up in the header of the html file.
I can see the CSS in View Source for some files and not for others.
I would like to know what governs this exposure.
I realise that anybody can view the CSS if they know how but I am OK with that.
Which browser are you using that does that? Whenever I use the “view source” option in the page I only ever see the link code when the CSS is in a separate file.
I don’t use that option much though as I have a userscript attached to the browser that adds a “view source” link into every page that displays the HTML content with links to all the other files that make up the page source.
I’m using IE8
See attached jpg. This shows the css for the forum page for this thread.