MOSTAGHASSI
asked on
Css codes are visible in source codes of page,why?
Hello;
I use DW 2015 cc for creating webpage and above php file added the link of css file as:
My css file also start with:
But when i see the source codes of php page i see that all css codes are included in the source codes,please let me know where is the problem?
Thanks
I use DW 2015 cc for creating webpage and above php file added the link of css file as:
<link href="css/home-stylesheet.css" rel="stylesheet"/>
My css file also start with:
@charset "utf-8";
/* CSS Document */
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
display: block;
}
But when i see the source codes of php page i see that all css codes are included in the source codes,please let me know where is the problem?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for all comments,i could find it.
ASKER
Before,that i had the old version of DW when i test a page on localhost and saw the source codes in browser,it was ok and the css codes was invisible,but it seams that by this new version when test on localhost then it include the css codes,i thought that i test it on remote server and it is ok on it,the codes of external css file is not invisible in browser source codes.
ASKER
Thanks again for all comments.
You don't break any license when the HTML and CSS is accessible. That's how browsers work, you can't prevent it anyway, even with certain right click disablers, the DOM is loaded and can be looked at with many tools like proxies, fiddler, inspecting browser cache and many more. That's not worth the protection.
It would still be very unusual you see the core CSS within the HTML view source, you would rather only see the link tag with the HREF, but you can click the HREF url and get to the CSS. If you would hide it, restrict access to it, the browser wouldn't be able to apply it.
Bye, Olaf.
It would still be very unusual you see the core CSS within the HTML view source, you would rather only see the link tag with the HREF, but you can click the HREF url and get to the CSS. If you would hide it, restrict access to it, the browser wouldn't be able to apply it.
Bye, Olaf.
ASKER
Yes, you are right,normally when we use external css file we must not see(it is invisible in browser source codes,but it is clear that load that css file and act) the css codes in browser source codes,for this reason i sent this question on E-E,i didn't had this experiences before that on localhost can see the css codes in browser source codes.
Thanks
Thanks
Localhost does not differ from a "real" or remote host in that aspect, you just have a different base URL but HREF addresses are specified relative to the base URI anyway, so I still don't get what difference you see and have where and why.
There is a big difference when working without any web server and use file:// links, but even then relative URLs are possible and commonly used, if your pages only are HTML, CSS, JS and image files, you have a static page and need no web server. The web server comes into play as soon as you want to use something dynamic, server side includes would be the simplest, PHP or any other scripting language and from there, any database or web service addressed from the basis of PHP will need a web server.
There is just a slight difference between localhost and domain.com. Indeed in regard to database access you typically do use root user on localhost both at your own development localhost PC and the scripts addressing URLs on the domain also work with localhost, as localhost on domain.com is domain.com, localhost simply is another term for "this", "here", "me", "myself".
Bye, Olaf.
There is a big difference when working without any web server and use file:// links, but even then relative URLs are possible and commonly used, if your pages only are HTML, CSS, JS and image files, you have a static page and need no web server. The web server comes into play as soon as you want to use something dynamic, server side includes would be the simplest, PHP or any other scripting language and from there, any database or web service addressed from the basis of PHP will need a web server.
There is just a slight difference between localhost and domain.com. Indeed in regard to database access you typically do use root user on localhost both at your own development localhost PC and the scripts addressing URLs on the domain also work with localhost, as localhost on domain.com is domain.com, localhost simply is another term for "this", "here", "me", "myself".
Bye, Olaf.
ASKER
Yes, i tested again on localhost with this url below and it is ok,there is no css codes in resource:
http://localhost/ppresponsive/indextest.php
But when i want to see the page in browser i push F12 and then the page come in bowser with this addrss:
http://localhost/ppresponsive/TMP1qismfu.php
With this url i saw and see that css codes are in resource codes,with this test i surprised that saw the css codes,so i thought that it is abnormal,but still i cannot understand that why these 2 url are different in browser source codes.
Thanks
http://localhost/ppresponsive/indextest.php
But when i want to see the page in browser i push F12 and then the page come in bowser with this addrss:
http://localhost/ppresponsive/TMP1qismfu.php
With this url i saw and see that css codes are in resource codes,with this test i surprised that saw the css codes,so i thought that it is abnormal,but still i cannot understand that why these 2 url are different in browser source codes.
Thanks
That's most probably Dreamweaver saving your current edit as a temp file and execute it via its internal web server. Visual Studio does similar things when you debug a web project. But his has nothing to do with the final publishing of all this.
I don#t use Dreamweaver, so this is just a wild guess, it may also be your browser, but double checking chrome and firefox don't create a new file when you view source or press F12, which does start developer tools in browsers. Also browser couldn't merge files the way you see it. So most likely dreamweaver does something more than just saving indextest.php as is as Tmp1qismfu.php, it merges things, which a browser would only do later at runtime, more precise which a browser will handle differently at runtime.
That's some of the behaviour I dislike about complex IDEs. There are pros and cons. If you instead start up a browser and manually start from http://localhost, then this will not cause a new php file being created and requested, you get 1:1 the request of and response from indextest.php
Bye, Olaf.
I don#t use Dreamweaver, so this is just a wild guess, it may also be your browser, but double checking chrome and firefox don't create a new file when you view source or press F12, which does start developer tools in browsers. Also browser couldn't merge files the way you see it. So most likely dreamweaver does something more than just saving indextest.php as is as Tmp1qismfu.php, it merges things, which a browser would only do later at runtime, more precise which a browser will handle differently at runtime.
That's some of the behaviour I dislike about complex IDEs. There are pros and cons. If you instead start up a browser and manually start from http://localhost, then this will not cause a new php file being created and requested, you get 1:1 the request of and response from indextest.php
Bye, Olaf.
ASKER
Thanks
ASKER
@Olaf Doschke,yes i see the codes of css file inside the source codes in browser.
yes
I don't know that staring the css file is ok?
The css file has created by Dw 2015.