Forum Discussion
Thanks Robert!
You are always there when I need help! I almost gave up hope. I will give it a try tomorrow and let you know.
Dave
Hi Robert,
As you suggested, I am using IE 11. Now I am getting runtime error:
TypeError: Cannot read property 'color' of null
var style = page.contentDocument.defaultView.getComputedStyle(colorPrimary, ""); Log.Message(style.background-color);I am not quite sure if I should be using
Log.Message(style.background-color);
- tristaanogre6 years agoEsteemed Contributor
In the code that I'm using, I get the element from the page in IE... then I get the "currentStyle.backgroundColor" property. I think that's better than the getComputedStyle method. See if that works better for you.
- royd6 years agoRegular Contributor
Thank you. I will give it a try.
- royd6 years agoRegular Contributor
I used:
var style = page.contentDocument.defaultView.currentStyle.backgroundColor(colorPrimary, "")
as you suggested.
I am getting:
JavaScript runtime error.
TypeError: Cannot read property 'backgroundColor' of undefined- tristaanogre6 years agoEsteemed Contributor
backgroundColor is not a method, it's the actual property. So, just compare that property to the desired value.
- royd6 years agoRegular Contributor
Hi Robert
Sorry for delayed response. It took me a while but finally figured it out. Thanks for pointing me to right direction. This is what finally worked:
var previewColor = previewSwatch.ownerDocument.defaultView.getComputedStyle(previewSwatch, "").backgroundColor;
Related Content
- 11 years agoRyan_Moran
Recent Discussions
- 3 hours agoashly