javascript - Front-end How to dynamically obtain the background color of a URL
我想大声告诉你
我想大声告诉你 2017-05-19 10:35:50
0
3
600

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

我想大声告诉你
我想大声告诉你

reply all(3)
Peter_Zhu

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

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

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

巴扎黑

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template