Is it possible to detect if a website (loaded in an iframe) is responsive or not? Can I fetch css media queries using javascript?
I need to identify the width/height parameters at which the responsiveness kicks in.
Any help will be appreciated. Thanks!
Guess, you could try smth. like:
//go throw all stylesheets
var isResponsive = false;
$.each(document.styleSheets, function(sheetIndex, sheet) {
//until found
if (!isResponsive) {
$.each(sheet.cssRules || sheet.rules, function(ruleIndex, rule) {
//if contains MediaQuery - go out
if (!!rule.media) {
isResponsive = true;
return false;
}
});
};
});
It works fine document, but could be blocked by security policy in case of iframe.
UPD: Also, you always able to get a page from another domain using JSONP and execute the code above for it's content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With