'Error: Permission denied to access property "resizeTo"
How to solve Permission denied error?
<script type="text/javascript">
window.addEventListener(
'message',
function (event) {
if (event.data.w && event.data.h) {
pop.resizeTo(event.data.w, event.data.h); // Error: Permission denied to access property "resizeTo"
}
}
);
function popup(url) {
pop = window.open(url, '', 'resizable=yes,scrollbars=yes,width=300,height=600');
pop.resizeTo(50, 50); // no error here, resize works
}
</script>
Note: popup(url) opens a popup on different domain.
Solution 1:[1]
Are you sure the error isn't coming from the if statement when you check if (event.data.h && event.data.w)? I would imagine that if you don't have permission to access to the event.data.h or the event.data.w your error would manifest there.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nicholas Robinson |
