Standard Unity Java script output ... doesn't work on web

Hi there, maybe someone can help me here :slight_smile:

When I export my unity model to a html and unity file. I get some standard javascripting, that I can then copy/paste into my html files on the website.

The problem is, that the javascript is somewhat not correct, when one of the scenarios occur.

Script is correct when the visitor has the unity player installed.

But when the visitor doesn’t have the unity player, another part of the script is executed and the visitor gets this box - where it says “Download the unity player”

Unfortunately the reading of the website stops after that… which mean that all the content that is piled up after the script (further down on the page) won’t be displayed. Which make the website look incomplete.

Take a look here (if you do have the unity player, you won’t see the error though).
www.sapling.dk/interaktion.shtml (not allowed to attach file, so you’ll have to check out the source on the website).

I’ve attached the html file.

Anyone who can help me solve this problem??

… in advance… thanks a lot!!

Thanks :slight_smile:

What is that thing in the corner of the building? It has no doors. Is it just an empty box?

Hehehe, I wish I knew… I’m just the project manager :smile: …

Well, I’m not sure any of us really know… besides the architech and this was what he was drawing / had planned.

Unfortunately we doesn’t get paid for thinking about it…

In general the sample JavaScript for player detection is rather solid and isn’t generally broken so let’s dig a bit deeper into what’s happening, or not, in your case…

What do you mean by “the reading of the website stops”? The JavaScript in question only affects the chunk where your Unity content should be displayed. If you’ve copied/pasted the code then make sure you’ve done it properly. But again, I’m just not clear on what you mean by “the reading of the website stops”, perhaps you can clarify what you mean by that?

I’ll remove my player and give that a test now.

Edit: back now and I see that your site does get, well, “goofy” when the install prompt is displayed. I’d focus your efforts more on if/how well your site handles the insertion of the installer divs and iFrame. I say that because your site might not integrate the script as-is well enough and so it would likely be worth it to have your web team take a look at that end of things to start. The same set of scripts work just fine elsewhere without interrupting sites, so it’s about sorting out what, if anything is unique to your site.

FYI: I helped write the detection code so if you or your web team needs help I’m here to offer that! :slight_smile:

Hey HiggyB,

Thanks a lot… Really cool to see people so committed to help out on problems :slight_smile:

I’ll see if I can isolate the script or change the iframe conditions.
I’ll return with an answer when I got some results.

Thanks again :slight_smile:

It was this line of code that made all the difference …

document.write(‘