It was recently reported that the new owner of the Polyfill project had injected Malware into the polyfill.js file. If your Magento 1 or Magento 2 store uses the Polyfill JavaScript, this may pose a serious threat to your store…
Using jQuery in a template (phtml) (Magento 2)
The following code shows how to load and use jQuery in a Magento 2 .phtml template.
|
1 2 3 4 5 6 7 8 9 |
<script> // Separate additional libraries with commas // In this example, jQuery UI require(['jquery', 'jquery/ui'], function($){ $(document).ready( function() { alert("fertig :-)"); }); }); </script> |
JavaScript translations are not working (Magento 2)
If you add a translation to a language CSV file (such as de_DE.csv), it may not be included correctly in your theme’s js-translation.json . Consequently, messages such as validation errors remain untranslated. To fix this, override vendor/magento/module-translation/Model/Json/PreProcessor.php and make the…
Generating CSS and JavaScript files manually for de_DE (Magento 2)
Sometimes JavaScript and CSS assets in Magento 2 are not loaded correctly. If you need to generate the JavaScript and CSS resources manually, you can do so from the Linux command line. The following command generates the files:
|
1 |
php bin/magento setup:static-content:deploy de_DE |
Comprehensive protection against content theft (Magento 1)
Have you ever been annoyed to discover that the content you worked so hard to write has simply appeared on a competitor’s website? Want to keep stolen content from hurting your business over time? Take action against content theft! The…
Protecting your store content from copying (Magento 1)
Writing content for a Magento store can take a great deal of time, effort and money. It is all the more frustrating when competitors simply copy that content and use it in their own stores. Even when the stolen text…
Activate JavaScript console for Firefox (Magento 1)
For whatever reason, the JavaScript console is not working for Magento by default. So if you try to output messages using console.log, nothing will happen. To change that, open js\varien\js.js and uncomment the following code:
|
1 2 3 4 5 6 7 8 9 |
if (!("console" in window) || !("firebug" in console)) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {} } |
What is “var Translator” and can it be removed? (Magento 1)
If you take a look at your Magento stores code, you might see the following JavaScript code:
|
1 |
var Translator = new Translate({...}); |
You might ask yourself, if its safe to remove that and what that code does. The code is responsible for translating your…