search

Home  >  Q&A  >  body text

javascript - Front-end How to dynamically obtain the background color of a URL

1. The requirement is to enter a URL, and the front-end can get the main background color of the corresponding URL

2. No matter how I look at the front-end, I can’t meet this requirement

3. Ask for some ideas

我想大声告诉你我想大声告诉你2737 days ago563

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-19 10:37:50

    The title of the question should be that you can dynamically enter the URL to get it. You can do it with node. The main thing is to load your html first, and thenwindow.getComputedStyle(document.body).backgroundColor

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:37:50

    window.getComputedStyle(document.body)['background-color']
    

    For methods like this, it mainly depends on what element the background color is on.

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:37:50

    For web pages, it should be possible to use an iframe with a width and height of 0 to introduce the target page, and then obtain the dom elements in the iframe

    reply
    0
  • Cancelreply