I have created a variable named myVar in a js file. The js file is located in the client folder of my meteor app.
I have checked that the js file has already loaded because the console.log('...') has printed but I can not see myVar when I want to call it.
The error message content is :
Uncaught ReferenceError: floaty is not defined
I just run into this problem right now. Try replacing 'var floaty' with 'window.floaty'
Related
I have downloaded the ckeditor4 via online builder and put the file in public folder in my project. I have the cheditor4-vue integration, but want to use the local editor instead of the CDN, so I followed the documentation and put the :url-editor in the ckeditor html tag and put the path to the ckeditor.js file in editorConfig. Now when I run my application I get the error massage Uncaught SyntaxError: expected expression, got '<' in the console. Could it be that the app is serving index.html instead of the ckeditor.js that I am pointing with my path?
One more thing, if I put the path to the ckeditor.js file in the browser, I get the content of it, like I would expect the app to do.
I got same error message before
Are you using plugin named image2?
extraPlugins: "image2,..."
If you did, remove image2 and change plugin from here: https://ckeditor.com/cke4/addon/image2
Add plugin like this way:
CKEDITOR.plugins.addExternal(
"image2",
"/static/xxx/image2/plugin.js"
);
...and dont use ckeditor default imageUpload plugin
Its work for me. No more error messages after this.
Sorry. My english so badly.
Hope this helps!
Is it possible to access variables from .env file from Content Script?
I am building a Chrome Extension and I have javascript Content Script file from which I listen to events on the browser page.
I would like to make an API call, so I need to access my API key, which is stored in .env file. When i try to call variables as const key = proccess.env.API_KEY i get an error: Uncaught ReferenceError: process is not defined.
I tried require('dotenv').config(); to help me with that problem, but since this is a normal js file and not Node.js, i get an erorr: Uncaught ReferenceError: require is not defined
So is there a way to load .env variables in normal JavaScript? Or should I use different approach?
This could look like a noob problem to some... I hope it is. I have a web app made using the php slim framework. I have the following hierarchy:
I'm trying to reference script1.js from template1.phtml and script2.js from template2.phtml. I'm doing the following:
template1.phtml
<script src="app/scripts/script1.js"></script>
template2.phtml
<script src="app/scripts/script2.js"></script>
template1 works just as expected but template2, even when it's practically the same, gives the following error:
GET http://localhost:8888/app/scripts/script2.js net::ERR_ABORTED 404 (Not Found)
WHAT I'VE TRIED
Set the full script2.js path to the src (using a few ../) which obviously works but is not the right approach.
NOTES
I'm using MAMP to test my app with php5.* When I run the app by using the command line and php7 both scripts are referenced properly.
to reference script1.js from template1.phtml , you could use ../../../app/scripts/script1.js
I have following line of code inside my js function saved as separate js file
$('#Page').val(#Html.Raw(Json.Encode(Model.MyFormats));
on page loading inside firebug console I'm getting following error
SyntaxError: illegal character
with pointer to # inside #Html.Raw...
Razor code is not parsed in external files. You need to assign the value of #Html.Raw(Json.Encode(Model.MyFormats) to a javascript variable in the main view and pass it to your external script (for example, assign it to a global variable and then use $('#Page').val(myFormats);)
I have a sample SproutCore app at https://github.com/ericgorr/myproject. The app is *sc_technique* inside of the project. This app is based upon the gist at https://gist.github.com/mauritslamers/5384031.
As best I understand the technique being described, the external data to be loaded is stored in the helper.js file. For example:
MyApp.statechart.sendEvent("loadData",[{ folder: "name": files: ["filename1.js"] }]);
It is then added to the document as a javascript script. The lines of the script are executed to generate events and the data is added to the app's SC.Store. After the script executes, it is removed.
When I attempt to implement this technique in my own app, I cannot get it to work. The error I am getting is:
Uncaught SyntaxError: Unexpected token : helper.js:1
It seems as if the app is trying to load the helper.js file before I tell it to do so. I get this error at the app first launches and before it executes the first line in main.js.
I know there are other problems in this app, but I cannot work on those until I can get past this problem.
as the browser is pointing out: there is a syntax error in the helper.js file:
the colon after "name" should be a comma.