A quick conversion of hmac_sha512 of php to a javascript library based jsSHA. e.g. if we had the php code: <?php $sign = hash_hmac(‘sha512’, $post_data, $secret); echo $sign; This can be converted to the jsSHA based javascript code like this: var shaObj = new jsSHA(“SHA-512”, “TEXT”); shaObj.setHMACKey(secret, “TEXT”); shaObj.update(post_data); var hmac = shaObj.getHMAC(“HEX”); I hope […]
Category: Javascript
[Solved]How to remove Render-Blocking javascripts
When a browser loads a webpage, while rendering it it has to parse the page. During the parsing process, if the browser comes across an external script it has to download it too which stops the parsing process until the JavaScript file is completely downloaded by the browser. With each file, it has to repeat […]
Prevent your site from being shown in iFrames using javascript
Data scraping is one of many pains bloggers and web developers face these days. Someone works hard enough to create a unique content and a unique code or script making their website useful and someone else simply uses iframes to show all their effort on their own website and getting all the credit. Or for […]
Javascript auto popup window code
This javascript auto popup window script will make a small popup window automatically open to your users when a page is loaded. This is great for showing some important messages to the users. Javascript auto popup window code Add this code to the head of your current page to open the popup using javascript. <SCRIPT […]
Allow numbers/digits only in input box using Javascript
Sometimes we need users to enter only digits / numbers in the input fields (e.g in zip code field) in our forms. In this article you will learn how to restrict any form input field to enter digits or numbers only using javascript. Although this can be by passed in some cases, but it still […]
How to print javascript Object
While debugging a code it’s useful to print or alert the data stored within an object. By using the code below you can print the data inside the object. You can also save it as a variable and use it your own way like saving it or loading it inside a specific div or an […]
Detect users internet browser (firefox, safari, iphone, ipod, ipad, internet explorer, opera ) and redirect to different page specific to it
Some times we need to detect the browser of the user in order to redirect them to browser specific page, or to do any other task that is related to displaying that website for that particular user’s browser, e.g firefox, opera, internet explorer, safari, or are coming from an iphone or an ipod. Edit: You […]