Issues with files loading based on path

隐身守侯 提交于 2019-12-13 03:54:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!