- Home /
How to make Unity's Own Web Player Code Validate? Loading UnityObject2; document.write() line can't validate
The manual gives the following code to load UnityObject2:
`var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"; if (document.location.protocol == 'https:') unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");`
`document.write('scripttype=txt/javascrpt src='+unityObjectUrl+'closeScript');`
But, the document.write line (last line) fails to validate. (first 4 errors).
The code works, but doesn't validate. It hates having script
inside those quotes (and/or has an issue with the tab (`<`) characters. I tried a few weird things, like using the escape characters or splitting it (putting "'+'" in the middle of the word). Nothing so far worked.
I can survive with a non-validating webpage but it would be nice if you could help me make it validate. : )
Note: The above code isn't exactly as it appears in the manual because it kept disappearing on me. Guess even Unity Answers' code thinger has trouble displaying html script tags.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091505im_/https://answers.unity.com/themes/thub/images/avi.jpg)