Script forbided in index.html

Again I need help.
I am designing a new plugin in witch I need to detect the ENTER key.
The problem is that Development Tools Debugger doesn’t accept script tag in the index.html file.

I get this error even there isn’t a script between the tags: ​ Uncaught UxpRuntimeError: Refusing to load inline script tag as executable code. Code generation is disabled in plugins.

If I add the script to detect the keyboardEvent another error is added: ​ Uncaught UxpRuntimeError: Refusing to load event handler tag as executable code. Code generation is disabled in plugins.

I uninstalled & reinstalled Photoshop & UXP Developer Tools.
Then striped both index files to almost nothing and still get the following error:

​ Uncaught UxpRuntimeError: Refusing to load event handler tag as executable code. Code generation is disabled in plugins.
    at Object.logInternalUncaughtException (uxp://uxp-internal/runtime_scripts_loader.js:2)
    at e.exports.didChangeAttributeForElement (uxp://uxp-internal/domjs_scripts.js:2)
    at e.exports.didChangeAttributeForElement (uxp://uxp-internal/domjs_scripts.js:2)
    at didChangeAttribute (uxp://uxp-internal/domjs_scripts.js:2)
    at a.set value [as value] (uxp://uxp-internal/domjs_scripts.js:2)
    at a.set nodeValue [as nodeValue] (uxp://uxp-internal/domjs_scripts.js:2)
    at e.exports.setAttribute (uxp://uxp-internal/domjs_scripts.js:2)
    at Object.createElement (uxp://uxp-internal/domjs_scripts.js:2)
    at e.exports._appendElement (uxp://uxp-internal/domjs_scripts.js:2)
    at uxp://uxp-internal/domjs_scripts.js:2
o @ uxp://uxp-internal/r…scripts_loader.js:2
logInternalUncaughtException @ uxp://uxp-internal/r…scripts_loader.js:2
didChangeAttributeForElement @ uxp://uxp-internal/domjs_scripts.js:2
didChangeAttributeForElement @ uxp://uxp-internal/domjs_scripts.js:2
didChangeAttribute @ uxp://uxp-internal/domjs_scripts.js:2
set value @ uxp://uxp-internal/domjs_scripts.js:2
set nodeValue @ uxp://uxp-internal/domjs_scripts.js:2
setAttribute @ uxp://uxp-internal/domjs_scripts.js:2
createElement @ uxp://uxp-internal/domjs_scripts.js:2
_appendElement @ uxp://uxp-internal/domjs_scripts.js:2
(anonymous) @ uxp://uxp-internal/domjs_scripts.js:2
we @ uxp://uxp-internal/domjs_scripts.js:2
_processToken @ uxp://uxp-internal/domjs_scripts.js:2
_processInputToken @ uxp://uxp-internal/domjs_scripts.js:2
_runParsingLoop @ uxp://uxp-internal/domjs_scripts.js:2
parse @ uxp://uxp-internal/domjs_scripts.js:2
t.parse @ uxp://uxp-internal/domjs_scripts.js:2
s @ uxp://uxp-internal/domjs_scripts.js:2
_loadHtmlContent @ uxp://uxp-internal/p…anager_scripts.js:1
loadMainFile @ uxp://uxp-internal/p…anager_scripts.js:1
loadDefaultMainFile @ uxp://uxp-internal/p…anager_scripts.js:1
bootstrap @ uxp://uxp-internal/p…anager_scripts.js:1

index.html

<!DOCTYPE html>

<html>
<head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <link rel="stylesheet" href="./vars/dist/spectrum-global.css">
	<link rel="stylesheet" href="./typography/dist/index-vars.css">
        <link rel="stylesheet" href="./page/dist/index-vars.css">
        <link rel="stylesheet" href="./button/dist/index-vars.css">
	<link rel="stylesheet" href="./icon/dist/index-vars.css">
	<link rel="stylesheet" type="text/css" href="./styles.css">
	<link rel="stylesheet" type="text/css" href="./jquery-ui.css">
	<script src="./jquery.min.js"></script>
	<script src="./index.js"></script>
  </head>
  <body>
  <input type="text" size="S" id="myLength" style=" position: absolute; left: 153px; top: 190px;" value =  "6000" onchange="setWidth()";> </input>

</body>
</html>

index.js

const batchPlay = require("photoshop").action.batchPlay;
const app = require('photoshop').app;
const UXP = require("uxp");
const fs = require('fs');
const fs1 = require("uxp").storage.localFileSystem;
var exeModal = require('photoshop').core.executeAsModal;

var doc = app.activeDocument;
var docWidth  = doc.width;
var docHeight = doc.height;
// console.log("docWidth:", docWidth, "docHeight:", docHeight);

const showAlert =  async (message) => {
await app.showAlert(message);
}

Please, can someone help?

onchange="() => setWidth()"

Or actually just

onchange="setWidth"

Can you post your manifest file here?

Thanks Karmalakas,

But I tried both and still get the error

Hi Jarda, the manifest was done Sorcerer. So did I goofed doing it ?

{
   "manifestVersion": 5,
   "name": "2D Gradient",
   "version": "1.0.0",
   "id": "2D Gradient",
   "main": "index.html",
   "requiredPermissions": {
      "launchProcess": "request"
   },
   "entrypoints": [
      {
         "type": "command",
         "id": "commandID",
         "label": {
            "default": "Show A Dialog"
         }
      },
      {
         "type": "panel",
         "id": "commandID",
         "label": {
            "default": "2D Gradient"
         },
         "icons": [
            {
               "width": 23,
               "height": 23,
               "scale": [
                  1,
                  2
               ],
               "path": "CHANGE_THIS_relative_path_to_dark_panel_icon.png",
               "theme": [
                  "darkest",
                  "dark",
                  "medium"
               ]
            },
            {
               "width": 23,
               "height": 23,
               "scale": [
                  1,
                  2
               ],
               "path": "CHANGE_THIS_relative_path_to_light_panel_icon.png",
               "theme": [
                  "lightest",
                  "light"
               ]
            }
         ],
         "minimumSize": {
            "height": 300,
            "width": 300
         },
         "maximumSize": {
            "height": 300,
            "width": 300
         },
         "preferredDockedSize": {
            "height": 300,
            "width": 300
         },
         "preferredFloatingSize": {
            "height": 300,
            "width": 300
         }
      }
   ],
   "host": [
      {
         "app": "PS",
         "minVersion": "23.0.0",
         "data": {
            "apiVersion": 2
         }
      }
   ],
   "icons": [
      {
         "width": 48,
         "height": 48,
         "scale": [
            1,
            2
         ],
         "path": "CHANGE_THIS_relative_path_to_light_icon.png",
         "theme": [
            "medium",
            "lightest",
            "light"
         ],
         "species": [
            "pluginList"
         ]
      },
      {
         "width": 48,
         "height": 48,
         "scale": [
            1,
            2
         ],
         "path": "CHANGE_THIS_relative_path_to_dark_icon.png",
         "theme": [
            "darkest",
            "dark"
         ],
         "species": [
            "pluginList"
         ]
      }
   ]
}

Sorcerer is still in the testing phase so there can be some issues with it.

You need additional permissions to make it work in manifest version5 with api2 as far I know. I think same permission that allows “eval()”

1 Like

The problem is that with this permission you might not be allowed to publish in Marketplace. So I think this is up to Adobe to make it clear.

Thanks,
OK I will try version 4 of the manifest

OK looks like it’s OK with manifest version 4.
So, thanks again