Skip to content

Author: admin@master

Redirect ranges of IPs in JavaScript (no .htaccess)

I’m trying to redirect anyone viewing my blog from certain IP addresses (or ranges of IP addresses) to a different page. I found something that works for individual IP addresses, but I can’t figure out how to block ranges of IP addresses – like 123.123.123.* Here’s the script: I’…

Javascript regex matching at least one letter or number?

What would be the JavaScript regex to match a string with at least one letter or number? This should require at least one alphanumeric character (at least one letter OR at least one number). Answer In general, a pattern matching any string that contains an alphanumeric char is However, a regex requirement lik…

ECMAScript 6: what is WeakSet for?

The WeakSet is supposed to store elements by weak reference. That is, if an object is not referenced by anything else, it should be cleaned from the WeakSet. I have written the following test: Even though my [1, 2, 3] array is not referenced by anything, it’s not being removed from the WeakSet. The cons…

Html2canvas image capturing issue with UTF-8 characters

I want to capture my webpage, In order to this I find html2canvas, when I use as shown below ,my UTF-8 (persian) characters get in trouble and this direction destroyed as you see. HTML: JavaScript: WebPage: Captured WebPage via html2canvas: you can see full example here What is wrong with my implementation? A…

Fixing greyed-out .owl-carousel div

I’m making a call to get a page (getresult.php) through AJAX. The ID div in my index: My footer: The script for calling getresult in the footer: Now this is my page getresult: My problem is the carousel class doesn’t work. When I remove the class owl-carousel, I can see the pic. I have the CSS and…

D3js find closest point on circle

what I’m trying to achieve is to take the current coordinates of a mousemove event and match them with the coordinates of the closest location on a circle. I’ve managed to get this partially working using a for loop which iterates over each possible point in the circle and compares the coordinates…