• Resolved doctorpeter

    (@doctorpeter)


    If I embed this code into a non WordPress page (created using Serif WebPlus) it works fine. The external js file is found and the image displays OK.

    If I embed it in a WP page using %CODE1% as advised, nothing displays and it seems that the js file is not located even though it is there.

    Any advice greatly appreciated.

    <script type=”text/javascript”>
    var arkiveApiSpeciesName = ‘Squatina%20squatina’,
    arkiveApiKey = ‘xC1QKw13gaiR9_9vlQZ8zkEICPTA4Ygk8kr9UgWzauY1’,
    arkiveApiSpeciesId = ‘a8b03c6d-33fe-4190-9015-9cb7014077b8’,
    arkiveApiWidth = 320,
    arkiveApiHeight = 355,
    arkiveApiImages = 0,
    arkiveApiText = 0;
    </script>

    <script type=”text/javascript” src=”https://nomoredodos.com/arkive-api-embed.js”></script&gt;
    <div id=”arkiveIframe”></div>

    This is the JS file

    function arkiveEmbedCallback(data) {
    var iframeCreation = ‘<iframe id=”frame” name=”widget” src =”#” width=”100%” height=”1″ marginheight=”0″ marginwidth=”0″ frameborder=”no”></iframe>’;
    var iframe = window.location.protocol + “//” + (data.results[0].url);
    if (data.error != ‘null’) {
    document.getElementById(“arkiveIframe”).innerHTML = iframeCreation;
    var iframeAttr = parent.document.getElementById(“frame”);
    iframeAttr.height = arkiveApiHeight;
    iframeAttr.width = arkiveApiWidth + 22;
    iframeAttr.src = iframe;
    }
    }
    (function () {
    function async_load() {
    var s = document.createElement(‘script’);
    s.type = ‘text/javascript’;
    s.async = true;
    s.src = ‘https://api.arkive.org/v2/embedScript/species/scientificName/&#8217; + arkiveApiSpeciesName
    + ‘?key=’ + arkiveApiKey + (arkiveApiSpeciesId ? ‘&id=’ + arkiveApiSpeciesId : ”) + ‘&mtype=all&w=’
    + arkiveApiWidth + ‘&h=’ + arkiveApiHeight + ‘&tn=’ + (arkiveApiImages ? 1 : 0) + ‘&text=’
    + (arkiveApiText ? 1 : 0) + ‘&callback=arkiveEmbedCallback’;
    var x = document.getElementsByTagName(‘script’)[0];
    x.parentNode.insertBefore(s, x);
    }
    if (window.attachEvent)
    window.attachEvent(‘onload’, async_load);
    else
    window.addEventListener(‘load’, async_load, false);
    })();

    https://www.ads-software.com/plugins/simple-embed-code/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Code works in WebPlus but not in WP’ is closed to new replies.