Scripts are not loading

Hi!

Our company installed H5P-plugin to our wordpress site. We are using multisite, and are trying to use plugin in main blog.

When I go to Add new -page, hub doesn't load, and page gets stuck, picture as attachment.

On console, there are lots of errors about loading css- and js-scripts. Here is one:

h5peditor-editor.js?ver=1.15.0:49 GET https://wp-content/plugins/h5p/h5p-editor-php-library/scripts/h5peditor-... net::ERR_NAME_NOT_RESOLVED

So it seems script urls are missing domains.

I tried to turn hub off and add content without it. I was able to do it, but when I added it to page and try to view it, same thing happens, when page tries to load iframe-content, scripts won't load. Here is example what it says on iframe's head-element:

<link rel="stylesheet" href="//wp-content/plugins/h5p/h5p-php-library/styles/h5p.css?ver=1.15.0">

Anyone got idea, what could be causing this?

Attachments: 
Content types: 

ie

http://wp-content/uploads/h5p/libraries/H5PEditor.TableList-1.0/h5p-edit...

load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.6.1:5 JQMIGRATE: Migrate is installed, version 3.3.2

jquery.js?ver=1.15.0:2 Allow attribute will take precedence over 'allowfullscreen'.

attr @ jquery.js?ver=1.15.0:2

h5p-editor-table-list.css:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

h5p-editor-range-list.css:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

h5p-editor-table-list.js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

h5p-editor-range-list.js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

presave.js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

h5peditor.js?ver=1.15.0:124 Error while loading script Event

(anonymous) @ h5peditor.js?ver=1.15.0:124

h5peditor.js?ver=1.15.0:124 Error while loading script Event

(anonymous) @ h5peditor.js?ver=1.15.0:124

h5peditor.js?ver=1.15.0:124 Error while loading script Event

(anonymous) @ h5peditor.js?ver=1.15.0:124

Same problem, why here no answers? What can cause problem? We have 2 enviroments, 1 is totaly fine, second have exactly same problem.

Any solutions?

otacke's picture

Hi!

The reason for not getting an answer might be that this is a community based forum, and if nobody in the community knows a solution or can suggest a way to find one, you will not receive one.

Best,

Oliver 

Same issue. We have 2 enviroments, one is totaly fine, second have exactly same problem, any solutions?

Same issue. We have 2 enviroments, one is totaly fine, second have exactly same problem, any solutions?

Hi!

I got it working by tweaking the code little. Now the problem is that i've got to make these changes every time the plug-in updates.


admin/class-h5p-content-admin.php
line 1004:
$url = '/' . preg_replace('/^[^:]+:\/\/[^\/]+\//', '', $upload_dir) . '/';
replaced with
$url = '' . preg_replace('/^[^:]+:\/\/[^\/]+\//', '', $upload_dir) . '/';

public/class-h5p-plugin
line 788:
$url[$id]['rel'] = '/' . preg_replace('/^[^:]+:\/\/[^\/]+\//', '', $url[$id]['abs']);
replaced with
$url[$id]['rel'] = '' . preg_replace('/^[^:]+:\/\/[^\/]+\//', '', $url[$id]['abs']);

line 1226:
self::$settings['core']['styles'][] = $rel_path . $style . $cache_buster;
replaced with
self::$settings['core']['styles'][] = 'https://yourdomain.com' . $rel_path . $style . $cache_buster;

line 1233:
self::$settings['core']['scripts'][] = $rel_path . $script . $cache_buster;
replaced with
self::$settings['core']['scripts'][] = 'https://yourdomain.com' . $rel_path . $script . $cache_buster;

Line numbers may have changed a little for newer versions.

Thank you for you answer and solution, sadly I can't afford to change plugin files each time after update, why H5P support is silenet, can anyone look into this problem, how to solve this without changes in plugin.

BV52's picture

Hi dwaydewade,

I will consult with the devs, but there are no guarantees that we will have a solution. One main factor is that I cannot reproduce the issue. I'll keep you posted if there they have any suggestions.

-BV