HTML without javascript

Hello,

I’ve created a document with just a few images and text. Is it possible to export it without javascript?

Thanks.

Unfortunately not – Tumult Hype’s runtime is based on JavaScript, which handles all positioning for those images.

1 Like

Thanks for your quick answer.

Short answer … no. As Hype renders everything “on the fly”.

Longer answer…


Version 1 (with script tags)


You can view it in Chrome. Then open the console and type …

copy(document.querySelector('html').outerHTML)

This copies the output to the clipboard and you then need to save it to a HTML file.


Version 2 (without script tags)


Only downside it still contains references to the scripts that generated the output in the first place.
One brute force way would be the same as described above but run this in your console …

var doc=document.querySelector('html').outerHTML; var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi; while (SCRIPT_REGEX.test(doc)) { doc = doc.replace(SCRIPT_REGEX, '');};copy(doc);

This removes the script tags before copying to the clipboard.

1 Like

Thanks,

When I copy the first line I get an “undefined”

Yes… but the content is in your clipboard. You only need either of the lines not both.
This is a total hack and probably only good for one scene layouts.

Yes, it worked!! but some special characters (it is in spanish) are lost and some code is shown at the top.

Can you share your document so I can try it for myself? Viví en formentera durante 8 años.

Claro! He hecho un un zip pero no me deja subirlo aunque dice que es zip es uno de los archivos admitidos…

https://www.dropbox.com/s/w1cfb5px539e4c7/html_hype.zip?dl=0

This worked for me… give it a try:

var head=document.querySelector('head').outerHTML; var HEAD_REGEX = /<div>|<\/div>|\&nbsp\;/gi; while (HEAD_REGEX.test(head)) { head = head.replace(HEAD_REGEX, '');}; var body=document.querySelector('body').outerHTML; var SCRIPT_REGEX = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi; while (SCRIPT_REGEX.test(body)) { body = body.replace(SCRIPT_REGEX, '');}; copy(head+body);

giving me this static page

Not working, same error. Can you send me the file that worked for you?

That is strange. Sure I am currently shopping grocery but after that.

Thanks. I’m on a Mac, if it helps…

I guess we all are using Hype and so on… :slight_smile:

:man_facepalming:Yes!!

Finally it worked in another computer, but if I see the code it still has javascript on it.

I am back. The script is certainly not perfectly debugged and I put it together on the spot. I guess it still needs testing in different environments. I ran it in chrome! And this is my output:

index_static.html.zip (5,3 KB)

I just realized that the URLs are full file refs and not shortend to relative paths. I’ll fix that next.

Yes, images are not displayed and the link is not working in “ver documentation técnica”.