Trying to create a link to an HTML file in Webstorms - javascript

I'm currently doing an assignment that involves modifying a game called Perlenspiel using an IDE (in my case, I'm using Webstorms.) I managed to mod the game properly as my changes are reflected into the actual game when I open it on Google Chrome (my browser.) But the assignment also requires me to copy the entire directory (I guess it means "folder containing the relevant files"), which includes the .js file and .html file that allow me to modify and launch the game respectively, to the cloud (Dropbox, Google Docs.) But the hard part is to create a link to the .html file in the directory where my .js file is also located. How do you do that? The game doesn't seem to work when I merely try to open the .html file after uploading it on Dropbox alongside the other relevant files such as the .js file. Can someone please help me?

Related

Modifying local files embedded in a Google Chrome Extension using JS

I have been doing a lot of research and have been unable to find an answer to my exact question. I understand that having a google chrome extension that can write to local user files would be a major security breach and thankfully isn't possible. However in my extension is a .json file that is used to make a HTML webpage with links via JavaScript. The JS reads the .json file and inserts the lines of code on the html page. I am attempting to make a user interface that allows them to update and edit the .json file that is inside the extension in order to add new lines of code to the webpage, but have been unable to find anything that could make this work due to security issues. I was thinking that since the file is in the extension users should be able to modify it.
If that was confusing here is a flow of what I want to happen and where it is not working:
Works:
Users clicks on button that takes them to a webpage hosted in the extension -> when page is loaded, the javascript runs -> the JS looks at a .json file in the extension using an XMLHttpRequest, parses the data, and then inserts it into the html -> The user now see's the content that was contained in the .json file on the html page.
Doesn't work:
After this I would like to have an interface that will allow the user to edit this .json file in order to update the page as they see fit, all in the extension itself.
If it was just me using this extension I could simply use the chrome storage api's available, however this is for my team at work, who are wanting to make edits as we need. Which means we will all be editing the same .json file.
Any information regarding this would be very beneficial. Even if it's as simple as it can't be done. Either way manually editing the .json file without a simple UI is much easier than editing the html directly.
Thanks in advance!
Posts/Articles I have looked at regarding this question:
Access Local Files using a Google Chrome Extension
https://developer.chrome.com/extensions/storage
Local file access with javascript
Allow Google Chrome to use XMLHttpRequest to load a URL from a local file

How to update/rebuild generated JavaScript files in a Cordova Android app?

When I make a change in one of my application's JavaScript files and rebuild, the JavaScript file that is compiled in the platforms/android/scripts folder should also reflect those changes, should it not? However, this does not seem to be the case right now. The generated js file in the android directory is always the same. If I blank out the whole file, it rebuilds itself just as it was. How can I get it to rebuild WITH the changes I made in the original JS file?

when i copy my html file in jsp and css file then my page design change

I am working on a project.Initially I worked in dreamweaver and created some html files and css for project interface. when i run index.html , in case of single folder contain all html files and css it run well no change in design and every div in its proper place and everything is well but now i am using neatbean and tomcat to run my project in java so for this purpose when i copy my html file code in jsp along with css and after deployment when i run index.jsp its design got changed and everything is mixed with each other for example menu and header mixed with each other and my page design corrupted. some one tell me how i can fix it.
Maybe is because you open a new file for the project, and copy the code of the html,css directly, if you have open a new project in netbeans for example the default folder of that project is in C:\Users\nameuser\Documents\NetBeansProjects if this is the case, just change the project folder to the html one

Accessing Js from file from outside an EAR/WAR

I have a requirement where a JS refernced by my web applications needs to reside on a location other than the context of the app. For eg. The deployed structure of my project looks like
myProj.ear/myProj.war/layout/thePageThatNeedsExternalJS.xhtml
this lives under $JBOSS_HOME/server/default/deploy.
Requirement states that theJavascript.js file should be present on the file system for eg. at
/home/amit/myJsFolder/theJavaScript.js
Now I tried referencing this JS using scr="file:///home/amit/myJsFolder/theJavaScript.js"
I also tried using "../../" path to try to point it to the right location but that does not seem to work either. I tried to see if the Js got linked by using the chrome developer tools and the js is not listed in the scripts section, but other scripts are for eg the Jquery script.
Is it even possible to link such a js inside a web app? Because I tried this on a single HTML page and it works.

How to share TinyMCE Javascript source across multiple ASP.Net sites

I'm using the Moxie code TinyMCE text editor (http://www.tinymce.com/) for content entry on a number of sites. At the moment I have the tiny_mce folder sitting in the folder of each site. This means that I have lots of copies of the same .js files.
I think it would be better to have one copy of the tiny_mce folder and reference it for each site - so if I make a change, or upgrade the tiny_mce I only have to do it once. Also, if I make a new site I can reference the same one to save needing to upload or copy another 9Mb of duplicated files onto the server.
I have tried putting the tiny_mce into a folder outside the individual websites and setting it up as a site on localhost that they can see.
I then include the javascript from each site like this:
<script type="text/javascript" src="http://localhost/MCE/tiny_mce/tiny_mce.js"></script>
I'm pretty sure the the file can be found by the site - I've tested with a simple javascript alert box test which works fine - and if I "View Source" and check the link it's using, I can access the tiny_mce.js file - which is the correct file.
However, the tiny_mce doesn't work.
I'm guessing there are some kind of dependencies or configurations that I'm not aware of that are causing a problem, but I'm not sure quite where to start to find out what isn't working. (I don't get any errors, it just doesn't load the tiny_mce)
Has anyone managed to get tiny_mce to share it's source files across multiple sites? Does tiny_mce require the .js files to be inside the root folder of the site in order to work?
Has anyone managed to get tiny_mce to share it's source files across
multiple sites?
I have not tried it yet.
Does tiny_mce require the .js files to be inside the root folder of
the site in order to work?
No.
Depending on your server system and in case your different website files are stored on one physical server device you could use a hardlink or softlink to the shared tiny_mce_folder (which should be accessible from the net too).

Categories

Resources