• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
Question by steunity2 · Jun 22, 2015 at 10:48 AM · c#unity 5webglfirefox

Application.OpenURL crashes Firefox on WebGL

Hi folks, I'm new to Unity.

I use following code to quit my application, but the WebGL build crashes my Firefox when I call Application.OpenURL(). WebPlayer build works fine.

 void Update ()
 {        
     // Exit game?
     if (Input.GetKeyDown (KeyCode.Escape)) {
         if (Application.platform == RuntimePlatform.WebGLPlayer
             || Application.platform == RuntimePlatform.WindowsWebPlayer
             || Application.platform == RuntimePlatform.OSXWebPlayer) {
             // Browsers go back to home
             Application.OpenURL ("http://localhost/");
         }
         #if UNITY_EDITOR
         else if (Application.platform == RuntimePlatform.WindowsEditor
             || Application.platform == RuntimePlatform.OSXEditor) {
             // Editors stop game mode
             UnityEditor.EditorApplication.isPlaying = false;
         }
         #endif
         else {
             // Standalone builds just quit
             Application.Quit ();
         }
     }
 }

Is this a known issue? Or, I should not even use Application.OpenURL to quit my browser application?

Some spec reports:

Unity 5.1.0f3

Firefox 38.0.5: WebGL - Crashes on Application.OpenURL

Chrome: WebGL - Works fine

IE: WebGL - Whole app crashes (I know it's not well supported yet, so it's ok.)

Comment

People who like this

0 Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image blurdot · Jun 27, 2015 at 09:33 PM 0
Share

We are also experiencing this. Seems like what's happening is we are leaving the page hosting the javascript of the application, but that javascript isn't stopped/released properly first.

Our solutions was to open a new window using external javascript and leave our app running...

avatar image blurdot · Jul 03, 2015 at 03:51 PM 1
Share

As an update:

WebGL for FireFox:

We were able to keep this from crashes when trying to link externally by using an external call to a javaScript function, setting the canvas to display=none, pausing for a second, and then redirecting like this:

 var redirectUrl = "";
 
 function unityRedirect(url)
 {
   document.getElementById('canvas').style.display = 'none';
   redirectUrl = url;
   setTimeout(redirect, 1000);
 }
 
 function redirect()
 {
   document.location.href = redirectUrl;
 }

The interesting thing is the WebPlayer is also causing a crash when we redirect from it's page in Firefox. The same functions did not solve that issue as it is an issue with Firefox's plugin container crashing. Please Unity fix this, the webPlayer did not used to do this.

avatar image steunity2 · Jul 06, 2015 at 02:46 AM 0
Share

@blurdot Thanks for the update. This is also my current solution to avoid the Firefox crash. I try to forget about WebPlayer from next projects, as it seems unity and browser vendors are deprecating it in the near future.

2 Replies

· Add your reply
  • Sort: 
avatar image

Answer by Schubkraft · Jul 06, 2015 at 09:57 AM

There seems indeed to be an issue. I reported it as a bug and sent it to the developers.

Comment
steunity2
Yanka33

People who like this

2 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by petrucio · Jan 18, 2016 at 07:45 PM

OpenURL indeed does not currently work on WebGL. You'll need to create a simple javascript plugin to handle onMouseUps, and handle your onMouseDowns to send events to said plugin. It sounds complicated, but it's simple once you get it. But you'll probably lose a couple hours to get it working the first time: http://va.lent.in/opening-links-in-a-unity-webgl-project/

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WebGL Input - KeypadEnter registering as Return 0 Answers

AWS Cognito Not Working with WebGL 0 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Ridiculous Error on Unity 5.6.4p4 Method Name doesn't exists 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges