function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Javascript: Error: Permission denied to access property 'document'

I have a standard page layout and within it, one section contains a VF page.  The VF page is fairly empty, except for a body onload javascript that creates a div and attempts to append it to the parent.


The section of the layout that contains the div is at the bottom of the page, but I'm trying to create the div so that it is fixed at the top of the page.


The div is created OK when you are just looking at the VF page alone, but trying it embedded within a layout results in that error message.


Does anyone have any ideas to fix that?


Thanks in advance!


<apex:page sidebar="false" showHeader="false" standardController="Opportunity">
<style type="text/css">
    color: #4A4A56;
    text-align: right;
    padding-right: 10px;
<script type="text/javascript" src="/soap/ajax/15.0/connection.js" > </script> 
<script type="text/javascript" src="/js/functions.js"></script> 
<script type="text/javascript">
function load()
var newdiv = parent.document.createElement('div');
newdiv.setAttribute('id', "thepanel"); = "50px"; = "50px"; = "fixed"; = "220px"; = "0px"; = "#000000"; = "1px solid #000"; = "9999"; = "0px";
newdiv.innerHTML = "test"; 
alert('error :'+error);
<body onload="load()">