I'm using Greasemonkey and trying to add a rule in a specific domain. But it results in an error saying The operation is insecure
.
The code works fine on Chrome.
The script runs on http://mydomain.com/test/test.php
And the CSS file is http://cdn.mydomain.com/test/css/global.css
My function:
function css(selector, property, value) {
for (var i=0; i<document.styleSheets.length;i++)
{
try
{
document.styleSheets[i].insertRule(selector+ ' {'+property+':'+value+'}', document.styleSheets[i].cssRules.length);
}
catch(err)
{
try // IE
{
document.styleSheets[i].addRule(selector, property+':'+value);
}
catch(err) {}
}
}
}
On Google I found that it could be because I'm trying to access cross-domains, so I've tried adding the URL to the CSS file to the 'accepted URLs' but no result.
How do I fix this?