ijprest / keyboard-layout-editor

Web application to enable the design & editing of keyboard layouts
http://www.keyboard-layout-editor.com/
Other
1.3k stars 241 forks source link

I compiled the source code and run on nginx,but the page is not displayed properly. #263

Closed Var-iazioni closed 5 years ago

Var-iazioni commented 5 years ago

The page displays something like {calcKbHeight()}} and function not available. Is it nginx's problem? But Tomcat seems almost the same. How to use Mongoose?

Var-iazioni commented 5 years ago

chrome f12 show

Uncaught ReferenceError: cssparser is not defined at kb.html:33

Access to XMLHttpRequest at 'file:///C:/Users/xxx/Desktop/keyboard-layout-editor-master/backgrounds.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, edge, https.

ijprest commented 5 years ago

You'll have to serve the page in an HTTP server; as you've discovered, loading the page via the file:// protocol won't work due to browser security restrictions.

Mongoose (and it's newer replacement, Civetweb) is just a single EXE. Drop it in the folder you want to serve, and double-click it. It will add an icon to your tray. (There's a config file for more advanced stuff, but some of it can be done from the tray icon; the only thing you really need to do is set the port to 8080, but that's only required if you want to test out the GitHub sign-in stuff.)

Var-iazioni commented 5 years ago

thanks again. I try to run on Mongoose, but error still exists. chrome f12 show:

Uncaught ReferenceError: cssparser is not defined
    at kb.html:33
angular.min.js:92 ReferenceError: $cssParser is not defined
    at updateFromCss (kb.js:588)
    at a.$$childScopeClass.$$childScopeClass.$scope.deserializeAndRender (kb.js:618)
    at c.<anonymous> (kb.js:682)
    at d (angular.min.js:35)
    at Object.instantiate (angular.min.js:35)
    at angular.min.js:67
    at angular.min.js:54
    at r (angular.min.js:7)
    at J (angular.min.js:53)
    at g (angular.min.js:47)

Maybe there's something wrong with my compilation.

Var-iazioni commented 5 years ago

You'll have to serve the page in an HTTP server; as you've discovered, loading the page via the file:// protocol won't work due to browser security restrictions.

Mongoose (and it's newer replacement, Civetweb) is just a single EXE. Drop it in the folder you want to serve, and double-click it. It will add an icon to your tray. (There's a config file for more advanced stuff, but some of it can be done from the tray icon; the only thing you really need to do is set the port to 8080, but that's only required if you want to test out the GitHub sign-in stuff.)

Sorry again for troubling you, I still can't compile the code correctly. Could you send the compiled code to my mail box? My email is variazioni@outlook.com Thank you very much!