Results 1 to 2 of 2

Thread: Cannot get correct path to use css and images

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Cannot get correct path to use css and images

    Hi.
    First note the I am doing this on an App_Offline.htm so this is on the root of the app.

    I have an ISS with the root folder containing an html file.

    When I view the folder with iexplorer inside htm I get the correct image ( that is included in the css definition).

    So I use

    <link rel="stylesheet" type="text/css" href="./default.css" />

    The image is in subfolder img.

    The css defines it as:

    Code:
    .vc_header_noeticket {
        background-color: white;
        height: 131px;
        margin-bottom: 0px;
        padding-left: 1px;
        border-bottom: 1px solid #E5E7E6;
    	background: url('./img/real/header_partner.png') white no-repeat;
        background-size: 100% 100%;
    }
    Notice that i use only one dot as the img folder is a subfoler in the root and I am running the htm file from the initial folder (not from a folder , for example home/something, so I should use 2 dots.In general I am running back and forth with the dots, testing with no avail).

    This work when i run it from inside the IIS server. When I run it outside from a PC I do not get the image.

    Here is what viewing code on a PC prints out:

    Code:
    <!DOCTYPE html>
    <html>
    <style>
    p {
        text-align:center;
    font-size: 150%;´
    color:blue;
    }
    </style>
    <body>
    
    <link rel="stylesheet" type="text/css" href="./default.css"  />
    
    </br>
    </br>
    <div class="container">
    <div class="col-xs-12 col-lg-12 col-md-12 col-sm-12 borders vc_header_noeticket">
                    <div class="row ">
                        <!-- Single button -->
                        <div class="col-xs-4 col-lg-4 col-md-4 vc_menu_item">
    
                        </div>
                        <div class="col-xs-3 col-lg-3 col-md-5 kulikeio_cell">
                            <span class="kulikeio">
                            </span>
                        </div>
                    </div>
              </div>             </p>
               </div>
            </div>
    
    
    </div>
    
       <p style="color:red;">Ç õðçñåóßá äåí åßíáé äéáèÝóéìç ëüãï Ýëëåéøçò åíôýðùí.</p>
    
    </body>
    </html>
    Some considerations. I have a local certificate so I add an exception but I have no issue with the general site showing.

    I also somehow made it possible to view the image on local pc. What I did what use firefox and then view page source, then I clicked on the css link.

    This created a link in the url box that did nothing "view-source:https://mysite.com/default.css" . Then I copied the https://mysite.com/default.css part. Then selected it and I show the source code. After that I went back to the correct website url and pasted and go to the url. The imae showed! Then when I again tried to refresh the site, the image did not show again. That was probably a cached CSS?

    So any help?

    Thanks.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: Cannot get correct path to use css and images

    Something strange is going on here. Must be some security issue.

    If I got to the url and do this: https://mysite.com/Header_partner.png ( I have moved the image to the root)

    Then it will not show anything. Then if i refresh the url a couple of times, it will show the image code.

    Then if I refresh the web site, it will show the image
    Last edited by sapator; Feb 23rd, 2018 at 07:47 AM. Reason: bummer
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width