表題についてブラウザでエラーがでます。どうすればエラーを解決できるでしょうか?
※補足1- handsontalbeのパスをcdnにすると正しく動きますが、handsontalbe6.2.2を使用したいため質問しています。全ソースを載せます。
※補足2 - wordpressとhandsontalbeを使用する場合の記事がありました。なので、このコードも記載しました。
https://stackoverflow.com/questions/23598044/include-handsontable-in-wordpress-plugin
エラー内容 http://localhost/wordpress/wp-content/plugins/show_text/js/handsontable.full.min.js” からのスクリプトが読み込まれました。しかし、この MIME タイプ (“text/html”) は正しい JavaScript の MIME タイプではありません。
環境:windows10
xampp
firefox
wordpress4.9.10
handsontable7.0.3
PHP
1<?php 2/* 3Plugin Name: Show Text 4Plugin URI: http://www.example.com/plugin 5Description: プラグイン 6Author: my name 7Version: 0.1 8Author URI: http://www.example.com 9*/ 10class ShowText { 11 12 function __construct() { 13 add_action('admin_menu', array($this, 'add_pages')); 14 add_action('wp_enqueue_scripts', 'my_backend_content_scripts'); 15 } 16 17 function my_backend_content_scripts() { 18 wp_register_script( 'my_js', 'http://localhost/wordpress/wp-content/plugins/show_text/js/handsontable.full.min.js', array('jquery'), null, true ); 19 wp_enqueue_script( 'my_js'); 20 } 21 22 function add_pages() { 23 add_menu_page('AAA', 'AAA', 'level_8', __FILE__, array($this, 'show_text_option_page'), '', 26); 24 } 25 26 function show_text_option_page(){ 27 ?> 28 <!DOCTYPE html> 29 <head> 30 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.css"> 31 32 <!-- 33 <script src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script> 34 --> 35 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 36 <script src="http://localhost/wordpress/wp-content/plugins/show_text/js/handsontable.full.min.js"></script> 37 38 39 <script type="text/javascript"> 40 41 $(document).ready(function () { 42 var container = document.getElementById('hst'); 43 44 hstdata = new Handsontable(container, { 45 data: [ 46 ['バナナ', '100'], 47 ['リンゴ', '120'], 48 ['イチゴ', '140'] 49 ], 50 colHeaders: ['名前', '値段(円)'], 51 colWidths: [100,100], 52 copyPaste: false, 53 language: 'ja-JP', 54 licenseKey:'non-commercial-and-evaluation' 55 }); 56 }); 57 </script> 58 </head> 59 <body> 60 <div id="hst"></div> 61 </body> 62 </html> 63 64 <?php 65 } 66 67} 68 69$showtext = new ShowText;
ご教授よろしくお願いいたします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/05/22 11:05 編集
2019/05/22 11:07 編集
2019/05/22 11:14
2019/05/22 11:36