Problem with CSS styles

0

I try to modify the way I see a website for that I change the reference of the attribute href for the one that is stored on my computer; basically it is the same file with a modification at the moment; the problem is that in doing so I completely lose the style of the page.

document.getElementsByTagName("link")[0].href = "http://127.0.0.1/Users/Maxi/Downloads/postcss-4e5c08be95c7e134a584e69258afd682.css"
    
asked by Maximiliano Alfonso 18.02.2018 в 00:51
source

1 answer

4

The problem is that you are pointing to an address that does not exist. The change in the JS is doing well and the code is correct, but the URL provided is not correct:

http://127.0.0.1/Users/Maxi/Downloads/postcss-4e5c08be95c7e134a584e69258afd682.css

that URL is pointing to a local server but, unless the root of your local server is the main unit of your computer (which I doubt), that address is not valid. So you're going to get a 404 error. Also, so you indicate in your comments , you are not using a local server, so the address 127.0.0.1 will not even work because it does not exist.

One solution would be to mount a local server (it's something you can do in a matter of minutes with WampServer or XAMPP ), make it run, put the CSS file on that local server and point to that file.

Alternatively, I would recommend using a tool / plugin for the browser such as Resource Override (for Chrome) or PourBico (for Firefox, this one I have not used it before), that it will allow you to replace resources of a website with local files without problems.

    
answered by 18.02.2018 / 01:19
source