• 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 /
avatar image
10
Question by Vagonn · Jan 26, 2016 at 06:23 PM · webglbrowserurltab

WebGL - Open URL in new tab?

How to open URL in new tab for WebGL?

Tried Application.OpenURL(). But it's opens a tab in same window

Thanks

Comment
Add comment
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

10 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by danielesuppo · Nov 04, 2016 at 08:18 PM

Yeah, but it does not work on Android devices with Chrome, so it's quite unuseable..

Comment
Add comment · Show 1 · 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 forerun · Jun 11, 2020 at 09:36 AM 0
Share

@danielesuppo the method at http://va.lent.in/opening-links-in-a-unity-webgl-project/ does work on mobile too you just have to add ontouchend to your jslib file... should look like this...

 var OpenWindowPlugin = {
     openWindow: function(link)
     {
         var url = Pointer_stringify(link);
         document.onmouseup = function()
         {
             window.open("YOUR.URL.CO$$anonymous$$");
             document.onmouseup = null;
         }
         var url = Pointer_stringify(link);
         document.ontouchend = function()
         {
             window.open("YOUR.URL.CO$$anonymous$$");
             document.ontouchend = null;
         }
     }
 };
 
 mergeInto(Library$$anonymous$$anager.library, OpenWindowPlugin);

just replace "YOUR.URL.CO$$anonymous$$" with the url you want to access...

Always a pleasure!

avatar image
0

Answer by avi9111 · Jul 25, 2017 at 12:42 PM

I think, if you are a js writer, you should would write the code like these.....

Application.ExternalEval("window.open('http://www.unity3d.com')");

I have to say the buddy on top write these first...........

Comment
Add comment · 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
0

Answer by Patrudoizero · Nov 18, 2020 at 08:28 PM

I have a button in a webgl app that opens my site in a new link. The problem is that after I press the button I have to click a second time anywhere in the page for the link to open. Is there a way to bypass this second click?

Comment
Add comment · 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
0

Answer by ddipietro1987 · Aug 29, 2021 at 11:49 PM

I have another answer which seems to be working for me. I had a lot of issues getting this to not break my Android builds of the application I'm working on. I need WebGL, Android, and iOS to build and validate correctly. I get a ton of build errors when including jslib files and extern marked methods. If you want all of your links opening new tabs, you can stick this in the header portion of your index.html and all links will open in new tabs.

This seems to be a solid solution if you're okay with all links opening in new tabs.

Comment
Add comment · 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
0

Answer by ddipietro1987 · Aug 25, 2021 at 07:18 PM

I have another answer which seems to be working for me. I had a lot of issues getting this to not break my Android builds of the application I'm working on. I need WebGL, Android, and iOS to build and validate correctly. I get a ton of build errors when including jslib files and extern marked methods. If you want all of your links opening new tabs, you can stick this in the header portion of your index.html and all links will open in new tabs. "base target="_blank " sorry this box wouldn't let me enter the appropriate <> portions.

This seems to be a solid solution if you're okay with all links opening in new tabs.

Answer 4 for correct formatting. https://forum.squarespace.com/topic/21952-force-all-external-links-into-a-new-tab/

Comment
Add comment · 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
  • ‹
  • 1
  • 2

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

50 People are following this question.

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

Related Questions

Unity WebGL switch to already opened tab 1 Answer

load URL images in Webgl. 1 Answer

Game pauses when user changes browser tab (even with RunInBackground) 1 Answer

Problems using Korean domain URL 0 Answers

How to read URL parameters from Unity WebGL Build 4 Answers


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