Hi Everyone,
I am using D365 9.1 online. I have a section on a form. On click of this section, it needs to display a custom HTML webpage. Before I start creating my actual webpage, I created a prototype HTML webpage and added it as a webresource., I added an iFrame inside that section referencing this HTML page I created. I need to call some external JavaScript functions in this HTML page. I am not able to. Here is a snippet of my code:
HTML:
<!DOCTYPE HTML>
<html>
<head>
<script src = "/WebResources/nikhilSampleJSPage" type="text/javascript"></script>
<title> <h1>Sample title</h1> </title>
</head>
<body>
testFunction();
<p> Sample paragraph. </p>
</body>
</html>
JavaScript webresource:
function testFunction()
{
alert("Message box displayed successfully.");
}
I have my suspicions on why it is not working to the following:
- Getting this message when I open developer tools - "Blocked script execution in is sandboxed and the 'allow-scripts' permission is not set dynamics 365".... Is this because I added the HTML page as an iFrame? If it is, how else can I accomplish displaying the custom HTML webpage on click of that section?
- The URL of the Javascript webresource does not have the ".js" in the extension. It looks something like " orgUrl/WebResources/nikhilSampleJSPage" When I mentioned the script src in the html page, I tried with both ".js" removed and with it. Both does not seem to work. Is this the issue? Am I messing something up in mentioning the script source?
- The heading and the paragraph is getting displayed.But the alert box is not.
Any help on this would be greatly appreciated. Thanks in advance.