Embedding Hype generated js-scripts in the very html-file

I’m a bit in doubt if the thread “Hi All - I’d really like to use Hype for Banner Ads …” (where I just put a somewhat similar question) was the place to ask, hence posting this question here:


If I want to embed the js-scripts (the content of the js-files), generated by Hype, in the very html-file, what should I alter in the js-code to make it work?


The question is derived from a request from ADTECH for hosting Hype AD-banners correctly …

With kind and thankful regards, Raaskot

Hi Mikael @raaskot

So in your exported HTML file you have code similar to this:

where your script tags point to the src in your resources folder

Instead of pointing to the source you can just paste the hype_generated_script.js source code in between the <script></script> tags in your HTML file similar to this:

<div id="**whatever your document name**" style="margin:auto;position:relative;width:1040px;height:800px;overflow:hidden;" aria-live="polite">    

<script type="text/javascript" charset="utf-8">
    //	HYPE.documents["**whatever your document name**"]

(function(){(function k( ........
</script> 

I believe that is what would have been done in the other thread

Hello and thanks, DBear. I also hoped it would be that simple yet it seems as a call is situated in the xx_hype_generated_script.js, which somehow, points to it self as an eksternal js-archive.

When running the html-file with embedded (pasted) js-tag a plain blank page shows up.

To make this otherwise one needs to make a fix in the embedded js-code, but I cannot figure out how …

Kind regards, Mikael

I found a solution. Thanks to this thread and Jonathan Deutsch I found an interesting and simple answer:

HTML-file:

(1) Place “HYPE-466.full.min.js” in <head></head> inside a <script></script> This seems to work for “thin.min.js” as well (tested).

(2) Place “xxx_hype_generated_script.js” in the <div></div>-tag inside a <script></script>, where scr-link to the external hypegenerated js-file normaly goes. The latter scr-linking must be deleted.

(3) In order to leave all files (images) combined in same root as the html-file: Go to the now embedded “xxx_hype_generated_script” and delete/change:


var f="xxx.hyperressources"
to
var f="."


See screendump:

2 Likes

Sorry, I didn’t realise you were including the HYPE-***.full.min.js in the head. I would have answered sooner. Of course, changing that variable would point it to the right place.

:smile:

To DBear:
No reason to be sorry! You kindly helped me in the proces:)
Regards, Mikael