diff --git a/Oqtane.Client/UI/Interop.cs b/Oqtane.Client/UI/Interop.cs index e3d6d76d..abe4eb7c 100644 --- a/Oqtane.Client/UI/Interop.cs +++ b/Oqtane.Client/UI/Interop.cs @@ -60,13 +60,13 @@ namespace Oqtane.UI } } - public Task IncludeMeta(string id, string attribute, string name, string content, string key) + public Task IncludeMeta(string id, string attribute, string name, string content) { try { _jsRuntime.InvokeVoidAsync( "Oqtane.Interop.includeMeta", - id, attribute, name, content, key); + id, attribute, name, content); return Task.CompletedTask; } catch @@ -105,6 +105,7 @@ namespace Oqtane.UI } } + // external scripts need to specify src, inline scripts need to specify id and content public Task IncludeScript(string id, string src, string integrity, string crossorigin, string content, string location) { try diff --git a/Oqtane.Server/wwwroot/js/interop.js b/Oqtane.Server/wwwroot/js/interop.js index 90c2bda4..5fc84ec2 100644 --- a/Oqtane.Server/wwwroot/js/interop.js +++ b/Oqtane.Server/wwwroot/js/interop.js @@ -27,14 +27,8 @@ Oqtane.Interop = { document.title = title; } }, - includeMeta: function (id, attribute, name, content, key) { - var meta; - if (id !== "" && key === "id") { - meta = document.getElementById(id); - } - else { - meta = document.querySelector("meta[" + attribute + "=\"" + CSS.escape(name) + "\"]"); - } + includeMeta: function (id, attribute, name, content) { + var meta = document.querySelector("meta[" + attribute + "=\"" + CSS.escape(name) + "\"]"); if (meta === null) { meta = document.createElement("meta"); meta.setAttribute(attribute, name); @@ -120,7 +114,13 @@ Oqtane.Interop = { } }, includeScript: function (id, src, integrity, crossorigin, content, location) { - var script = document.querySelector("script[src=\"" + CSS.escape(src) + "\"]"); + var script; + if (src !== "") { + script = document.querySelector("script[src=\"" + CSS.escape(src) + "\"]"); + } + else { + script = document.getElementById(id); + } if (script === null) { script = document.createElement("script"); if (id !== "") {