Javascript
Error after upgrading Magento to latest version
Sometime when you upgrade Magento to latest version you will have this error in the console
Password Protect CMS Page
Password Protect CMS Page
to protect any page with a password in an easy way you can add this script to the top of the page
<script type="text/javascript">
var password = 'password123'
var retVal = prompt("Enter your password : ", "your password here");
if(retVal !== password)
{
location.assign('');
}
</script>
Javascript add/update parameter to url string
One of the best code I saw is the below code which is a good way to change the URL without refresh the page, here is the code
Magento 2 static files are not working
How many times you tried to install Magento 2 and later you could not see the website working !!, How many times you tried to search for these sentences
"Magento 2 css not working"
"Magento 2 js not working"
"Magento 2 404 page not found" because of the static files?
Now here is the solution, and easily it is the missed .htaccess (for apache)
by quick look at this path "{magento root}/pub/static", you will see that you missed the .htaccess file
Change the display time of exception message magento 2
To change the time please copy this file
vendor\magento\module-ui\view\frontend\web\js\view\messages.js
to your them to be in this path
app\design\frontend\{vendor}\{theme}\Magento_Ui\web\js\view\messages.js
then modify this function
How to detect a mobile device in jQuery?
You can use this script to detect the screen size as you want