Question

I tried to embed a rich text text editor in my HTML page. The text editor works when the page is loaded seperately. But when I load the page through my django server, the Rich Text Editor does not work. the HTML page:

<html>
        <head>
                <script type="text/javascript" src="/home/aswin/python/myblog/tinymace/js/tinymce/tinymce.min.js"></script>
                <script type="text/javascript">
                tinymce.init({
                            selector: "textarea"
                             });
                </script>
        </head>
        <body>
                <form method="post" action = "/home/add/">
                    <input type = "text" value = "Title" name = "title">
                    <textarea >Hello</textarea>
                    <input type = "submit" value = "Post">
                </form>
        </body>
</html>

Can anyone help me?

Was it helpful?

Solution

You are trying to load a JavaScript file from location directly on your local hard drive (/home/aswin/python/myblog/tinymace/js/tinymce/tinymce.min.js). Websites you load from a server (even a Django development server running on your local machine) are not supposed to be able to load files from user's local hard drive, so your browser blocks this.

Please, read about managing static files through Django.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top