Ruta Ruta - 11 days ago 5
HTML Question

How to get color of iframe in php webpage?

I want to create color picker which will select color from other websites onclick in PHP web page.

I have given option to add url for reference website for color selection in my webpage. And I am opening reference url in Iframe but I am not getting color of iframe on clicking of it.

<!DOCTYPE html>
<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script>
$('iframe').load(function(){ $($("iframe")[0].contentWindow).on('click', function(event) { alert('test'); });});
</script>
</head>
<body>
<iframe id="iframe" src="http://www.theuselessweb.com/" width="500px;" height="500px">
</iframe>
<br>
</body>
</html>

Answer

I got alternate option to get colors from other website. To get color first I am getting screenshot of entered url using google pagespeed api and from that image I am getting colors codes

Comments