ankush981
ankush981

Reputation: 5417

Failed to load TinyMCE JS (Codeigniter)

I'm building a simple document management application but the TinyMCE JS is failing to load (403 error). First I thought this had something to do with file permissions and so I recursively changed everything to 777 (yes, stupid of me but I badly wanted this to work); but this didn't solve anything.

The Chrome console tells me:

Failed to load resource: the server responded with a status of 403 (Forbidden)

Here's my view page which attempts to load the editor:

<script language="javascript" type="text/javascript" src="http://localhost/ankdocs/application/js/tinymce/jscripts/tiny_mce/tiny_mce.js"/>
<script language="javascript" type="text/javascript">
  tinyMCE.init({
    theme : "advanced",
    mode: "exact",
    elements : "doc",
    theme_advanced_toolbar_location : "top",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,"
    + "justifyleft,justifycenter,justifyright,justifyfull,formatselect,"
    + "bullist,numlist,outdent,indent",
    theme_advanced_buttons2 : "link,unlink,anchor,image,separator,"
    +"undo,redo,cleanup,code,separator,sub,sup,charmap",
    theme_advanced_buttons3 : "",
    height:"350px",
    width:"600px"
});
</script>

<div id="newdoc">

<table>
<tr>
  <td>Document name:</td>
  <td><input type="text" id="docname"/></td>
</tr>
</table>

<textarea id="doc" name="doc" rows="20" cols="40">Type here</textarea>

</div>

As you can see, nothing fancy here. Somebody told me that perhaps some Apache module is missing (I'm on Ubuntu) but I'm really not sure how to fix that.

Please help!

Let me know if more code is needed.

============ Extended ===========

As requested in the comments, here's the output for search on .htaccess file:

root@vostro:~# find /opt/lampp/htdocs/ -iname '*access'
/opt/lampp/htdocs/xampp/sqlite/.htaccess
/opt/lampp/htdocs/ankdocs/application/cache/.htaccess 
/opt/lampp/htdocs/ankdocs/application/.htaccess 
/opt/lampp/htdocs/ankdocs/system/.htaccess

The file ankdocs/application/.htaccess says "Deny from all." The file ankdocs/system/.htaccess says "Deny from all."

Upvotes: 1

Views: 2246

Answers (2)

Nerdroid
Nerdroid

Reputation: 13966

it seems that you put the js folder inside the application folder which is used by codeigniter try moving the js folder outside the application folder i think codeigniter is trying to resolve the path to a controller which does not exist

and change your JavaScript reference to the new path somthing like that

<script language="javascript" type="text/javascript" src="//localhost/ankdocs/js/tinymce/jscripts/tiny_mce/tiny_mce.js"/>

good luck and Merry Xmas

Upvotes: 1

chanchal118
chanchal118

Reputation: 3647

Create a folder named assets inside ankdocs. Put your js file there. Actually cut tinymce/jscripts/tiny_mce/tiny_mce.js and put in assets/js and change

<script language="javascript" type="text/javascript" src="http://localhost/ankdocs/assets/js/tinymce/jscripts/tiny_mce/tiny_mce.js"/>

Upvotes: 1

Related Questions