Category : javascript

body { vertical-align: center; margin: auto ; width: 90%; } div { display: inline-block; margin-top: 30px; margin-right: 50px; width: 300px ; border-radius: 15px; border: 1px solid rgb(218, 218, 218) ; background-color: rgb(218, 218, 218) ; padding: 8px ; text-align: center; } input { float: right; } div:hover { background-color: rgb(190, 180, 180); } <!doctype html ..

Read more

I have currently have a php file doing some string replacement: langfr.php <?php $filecontent = file_get_contents(‘file.php’); $filecontent = preg_replace(‘/benglishb/’, ‘french’, $filecontent); file_put_contents(‘file.php’, $filecontent); ?> I have a on another page a javascript listener for a button that is trying to simple call the php function and have it run the code, I then refresh to ..

Read more

At Calculating the script hash we can see how to calculate the JavaScript hash in case of AMP: const crypto = require(‘crypto’); const hash = crypto.createHash(‘sha384’); function generateCSPHash(script) { const data = hash.update(script, ‘utf-8’); return ( ‘sha384-‘ + data .digest(‘base64’) .replace(/=/g, ”) .replace(/+/g, ‘-‘) .replace(///g, ‘_’) ); } How can I do the same in ..

Read more