我想创建颜色选择器,它将在 PHP 网页中点击时从其他网站选择颜色。
我已经提供了在我的网页中为颜色选择添加引用网站 url 的选项。我在 Iframe 中打开引用 URL,但在单击它时没有获得 iframe 的颜色。
<!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>
最佳答案
我有其他选项可以从其他网站获取颜色。为了首先获得颜色,我使用 google pagespeed api 获取输入的 url 的屏幕截图,并从该图像中获取颜色代码
关于php - 如何在php网页中获取iframe的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40421191/