extesy / hoverzoom

Google Chrome extension for zooming images on mouse hover
https://chrome.google.com/webstore/detail/hover-zoom%20/pccckmaobkjjboncdfnnofkonhgpceea
MIT License
1.14k stars 178 forks source link

How to support HoverZoom on my website? #105

Closed Nesh108 closed 8 years ago

Nesh108 commented 8 years ago

Hello there!

I am making a small website and I would like to support HoverZoom since I absolute love it!

I tried the following:

Since nothing seemed to work, I thought I would ask you directly.

How can I support HZ?

Btw, I am testing this by running my backend locally (localhost), creating a simple HTML page with just:

<html>
<body>
    <a href="http://localhost:4000/image/lolcat1.png">image</a>
</body>
</html>

When I try to hover, nothing works.

Just to be complete, the API requires a Basic Auth but, when testing, the browser has already access to the image.

Thanks in advance!

extesy commented 8 years ago

@Nesh108 Please open the Chrome's dev console and check if there are any error messages.

Nesh108 commented 8 years ago

@extesy no error whatsoever. I am not sure if that's supposed to happen, but nothing changes in the Network tab either.

P.S. HZ on Reddit works normally.

Edit: Here are the response headers:

Cache-Control:no-cache, private
Content-Length:33827
Content-Security-Policy:frame-ancestors 'self'
Content-Type:image/png
Date:Thu, 30 Jun 2016 06:05:44 GMT
Expires:-1
Pragma:no-cache
Strict-Transport-Security:max-age=15768000; includeSubDomains
X-Content-Type-Options:nosniff
X-Frame-Options:deny
X-Xss-Protection:1; mode=block
Nesh108 commented 8 years ago

@extesy I was taking a super quick look at the code in js/hoverzoom.js and I noticed this comment:

// Only zoom jpg images, to prevent zooming on images that are part of the site design

Is that correct? If so, would it be enough to just change my endpoint to ending with .jpg? Or is hoverzoom smarter and actually check the Content-Type as well?

EDIT: I just tried with this: https://i.stack.imgur.com/ILTQq.png and it worked. So, it's not related to the extension...

Nesh108 commented 8 years ago

@extesy Anything? It should be quite easy to support this tool since it can already handle so many websites.

extesy commented 8 years ago

I haven't looked into this yet. It might be that Chrome is just not loading this extension for localhost pages. In any case, the extension operates on urls by scanning page html code after it's loaded, so headers don't matter.