The reason your custom cursor isn't working in Firefox and Chrome is likely due to the cross-origin policy of the browser. Browsers have security restrictions when it comes to using external resources as custom cursors to prevent potential misuse and protect user privacy.
When you use the cursor
CSS property with a URL, the browser treats it as an external resource and may block it from being used as a cursor if it doesn't comply with the same-origin policy. Essentially, the cursor image must be hosted on the same domain as the web page for it to work in modern browsers.
In your case, the image URL you provided (http://anuary.com/dev/hp/pad3/public/images/hand-cursor.png
) seems to be hosted on a different domain (anuary.com
) than your web page. As a result, the browser is blocking the use of the image as a custom cursor.
To make it work, you have two options:
Host the image on the same domain: Upload the hand-cursor.png
image to your own server and update the URL in your CSS accordingly. This way, the image will be served from the same origin as your web page, and the cross-origin policy won't be violated.
Base64 encode the image: Convert the image to a data URL using Base64 encoding and use that data URL directly in your CSS. This method embeds the image data into the CSS, making it work regardless of the origin. Here's how you can do it:
- Use an online tool to convert the image to a Base64 data URL.
- Update your CSS to use the Base64 data URL:
body {
cursor: url('data:image/png;base64,PUT_YOUR_BASE64_ENCODED_IMAGE_HERE');
}
Replace PUT_YOUR_BASE64_ENCODED_IMAGE_HERE
with the actual Base64 encoded image data.
Keep in mind that using Base64 encoded images in CSS may increase the CSS file size, so be cautious when using this approach for large images. Also, note that some older versions of Internet Explorer may not support this method, but it should work fine in modern versions of major browsers like Firefox and Chrome.