问题
I'm using rails 2, and in one of the plugin I'm working on, I found this weird issue, I've TinyMce 4 customized text editor.
I've loaded the script at the beginning of the page, in the new form.
<script type="text/javascript" src="../tinymce/tinymce.min.js"></script>
TinyMce loads normally, and works completely fine.
In case of edit form the same script tag above doesn't work, I've move up 1 level to load it, I mean
<script type="text/javascript" src="../../tinymce/tinymce.min.js"></script>
Out of curiosity, what is going on here?
Folder Sturucture.
>>plugin_name
>>app
>>config
>>db
>>lib
>>public
>>images
>>javascripts
>>stylesheets
>>tinymce
回答1:
I suspect your new page has a url like : /post/new
whereas your edit page has a url like /post/1/edit
Because the edit URL has an extra /
you need to go up an extra level in the relative path in your script tag.
Try changing the TinyMCE include to be an absolute path, not a relative one:
<script type="text/javascript" src="/tinymce/tinymce.min.js"></script>
来源:https://stackoverflow.com/questions/18912088/issues-with-files-loading-based-on-path