Skip to content

Instantly share code, notes, and snippets.

noopener-allow-popups Cross-Origin-Opener-Policy value

Some origins can contain different applications with different levels of security requirements. In those cases, it can be beneficial to prevent scripts running in one application from being able to open and script pages of another same-origin application. Such a document need to ensure its opener cannot script it, even if the opener document is a same-origin one.

The noopener-allow-popups Cross-Origin-Opener-Policy value severs the opener relationship between the document loaded with this policy and its opener. At the same time, the opened document can open further documents (as the "allow-popups" in the name suggests) and maintain its opener relationship with them, assuming that their COOP policy allows it.

@yoavweiss
yoavweiss / Remap_esc_key.sh
Created October 7, 2018 20:14
Remap § to Esc and Esc to F24
#!/bin/bash
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}, {"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000073}]}'
@yoavweiss
yoavweiss / preload_feature_detection.js
Last active July 24, 2020 19:31
Preload feature detection
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@yoavweiss
yoavweiss / domtokenlist_feature_detection.js
Last active January 10, 2020 17:36
DOMTokenList supports() example
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
<picture>
<source srcset="http://placehold.it/300.png">
<img src="http://placehold.it/100.png" id=bla>
</picture>
<script>
(function() {
var img = document.getElementById("bla");
img.parentNode.removeChild(img);
})();
</script>
@yoavweiss
yoavweiss / gist:2b6a5fdb991be72a1f79
Created December 3, 2015 17:12
DOMTokenList feature detection
var tokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return false;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@yoavweiss
yoavweiss / dabblet.css
Last active August 29, 2015 14:20 — forked from LeaVerou/dabblet.css
Media query to detect full screen mode!
/**
* Media query to detect full screen mode!
* Y U NO WORK Chrome??
* Firefox, you’re lovely.
*/
body {
background: red;
font: bold 400% Helvetica Neue, sans-serif;
color: white;
@yoavweiss
yoavweiss / gist:cc867d5e63c1132c6cd3
Last active October 6, 2015 20:31
Responsive images links

Official RICG Web sites

Articles explaining the various use-cases and solutions:

@yoavweiss
yoavweiss / gist:10023162
Created April 7, 2014 16:03
sizes test cases
TestCase testCases[] = {
24 {"screen", 300},
25 {"(min-width:500px)", 300},
26 {"(min-width:500px) 200px", 200},
27 {"(min-width:500px) 200px, 400px", 200},
28 {"(min-width:5000px) 200px, 400px", 400},
29 {"(blalbadfsdf) 200px, 400px", 400},
30 {0, 0} // Do not remove the terminator line.
31 };