修改我的服务器上的js文件并重新加载它?
如果我在
我正在使用 document.write ("") 加载 js 文件,该文件有效。
顺便说一句,这个网站不允许我放置“<”在文档中写。
If I loaded a js file in a <textarea>
with a save button below it, can I save that to an existing js file on my server and then reload it. Basically, what I want to do would work just like a wysiwyg except I want to be able to save the js to an existing file.
I am loading the js file using document.write ("<script src='file.js'></script>
") which works.
BTW, this site would not let me put the '<' in the document write.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答:是的,但从你的帖子来看,我认为你不会觉得这很容易。
更深入地说,您需要使用服务器端语言(例如 PHP)来实现此目的。
我不会介绍如何设置 PHP,我们假设您知道这一点,如果您不知道,那么您就有一个很好的借口去谷歌搜索:) 但是,这里有一个简单的工作示例脚本。
警告:允许人们写入服务器上的文件存在很多陷阱。您当然不想让除了高度信任的人之外的任何人都可以访问这样的东西。除非您了解其含义,否则我不能过分强调您对此类事情应该多么小心。
Short answer: Yes, but from your post I don't think you'd find it easy.
In some more depth, you'll need to use a server-side language such as PHP for this.
I won't go into how to get set up with PHP, we'll assume you know that, and if you don't then you have a great excuse to go Googling :) However, here's a simple working example script for you.
WARNING: There are a lot of pitfalls with allowing people to write to files on your server. You CERTAINLY don't want to make something like this accessible to anyone except HIGHLY trusted people. I can't over-emphasise how careful you should be with something like this unless you understand the implications of it.