如何在JavaScript中创建网址预览? [英] How to create url preview in JavaScript?

查看:147
本文介绍了如何在JavaScript中创建网址预览?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我在JavaScript中创建一个url预览吗? 我的意思是这样的:假设我在我的网站上有一个链接,我希望用户能够将鼠标悬停在链接上,并弹出一个图像显示链接的目标是什么样的。



不用担心css,我得到了这个工作,我只需要实际的脚本来显示图像。 / p>

目前我正在通过显示实际呈现页面的iframe来完成此操作,但这不是可伸缩的,而且看起来很难看。

让页面显示预制图像不是一种选择,因为链接将链接到动态生成的用户内容。

解决方案

您需要预先存储图像。 Javascript无法截图并调整图像大小(现在)。试试这个: http://snapcasa.com/ 。它动态地为你拍摄图像。所有你需要做的就是热连接图像:)



使用 http://snapcasa.com/


  1. 图像保证是最新的,您不必将它们存储在您的服务器上!


  2. >免费计划有很多学分可供您刻录!



Can someone help me with creation of a url previews in JavaScript?

What I mean is this: Say I have a link on my site, I want the user to be able to mouse over the link, and have an image pop up that shows what the target of the link looks like.

Don't worry about the css, I got that working, I just need the actual script to show the image.

Currently I am doing it by showing up an iframe that actually renders the page, but this is not scalable and looks ugly.

Having the page display premade images is not an option, since the links will be linking to dynamically generated user content.

解决方案

You need to have pre-stored images. Javascript cannot take screenshots and resize the images (for now). Try this: http://snapcasa.com/ . It takes images dynamically for you. All you have to do is to hot link the images :)

The best features when using http://snapcasa.com/:

  1. Images are guaranteed to be most up-to-date

  2. You don't have to store them on your server!

  3. Free plan has lots of credits for you to burn!

这篇关于如何在JavaScript中创建网址预览?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆