locked
Asp-fallback tag helper download both resources always !! RRS feed

  • Question

  • User-158191824 posted

    This is my stylesheet  code on my local host: (I'm using W3.Css not bootstrap for simplicity, it does not matter)

       <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/w3-css/4.1.0/w3.min.css"  
              integrity="sha384-0nVq6A/447RzBXaNDJcOYIFNXgWuxcfer/j7yhnrw3keDMhIy3drbhOgJzuLY81J" crossorigin="anonymous"
              asp-fallback-href="~/css/w3-4.1-min.css"
              asp-fallback-test-class="w3-left"
              asp-fallback-test-property="float"
              asp-fallback-test-value="left !important"
              asp-suppress-fallback-integrity="true">

    So in theory, it should check first source (cloudflare) and if not succeeded it should downlod fallback-href from my local host ..

    But it is always downloading both sources and caches both of them to the browser when a request is sent !! 

    I deleted/renamed my local css file, so the external (cloudflare) becomes active ! I disconnected internet connection/rename cloudflarelink/change hash code/... so always local file used, but when both of them are next together as you see in above, I expect the external css file comes to service as it was  downloaded but didn't effect the page, because the second one is downloaded too and has more priority I think!! 

    I changed some classes in my local file (and surely not the one to be tested in asp-fallback-test-class), to find out which css file (internal/external) is active at the moment. If the above code is wrong so why when I disorder/dismiss any of the two, another comes to service ?? but when both of them are in service always my local has more priority but I do not want it !

    Monday, December 7, 2020 11:04 AM

Answers

  • User-158191824 posted

    Thanks for replying. I changed the test class so I got the favorite . 

    asp-fallback-test-class="w3-check"
    asp-fallback-test-property="position"
    asp-fallback-test-value="relative"

    I do not know why this happened , maybe the word "! important" in test value was problem. I really don't know what kind of class-test should we check for call back. But your trigger made me to answer. Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 7, 2020 6:12 PM

All replies

  • User-474980206 posted

    the fallback tag helper is simple. with javascript it renders a meta tag with the specified class name. it then checks if the meta tag has property and value specified in the test. if the javascript test does not match,  it adds a link to the fallback. the fallback then overrides the originals,

    if your page is loading both (use browsers network trace), then the property test is failing. you will need to update it. 

    Monday, December 7, 2020 4:43 PM
  • User-158191824 posted

    Thanks for replying. I changed the test class so I got the favorite . 

    asp-fallback-test-class="w3-check"
    asp-fallback-test-property="position"
    asp-fallback-test-value="relative"

    I do not know why this happened , maybe the word "! important" in test value was problem. I really don't know what kind of class-test should we check for call back. But your trigger made me to answer. Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 7, 2020 6:12 PM