Retrieving URL

hi,

I have made a web game and for that, after logging in i am redirecting it to one url using php.

Now, i want to retrieve that url in to unity using java script.

I have tried Application.absoluteURL and Application.srcValue.

But these are fetching the .unity link but not that one which is present in the navigation tool bar.

Now, I want the url which is present on the navigation toolbar.

How to get that…

Thanks!

Just to make sure I understand your question, you’re logging into a website through a php interface, e.g.

mysite.com/login.php

And then redirecting to a page, e.g.

mysite.com/mygame.html

which then loads a Unity webplayer app e.g.

mysite.com/WebPlayer/mygame.unity3d

and you want to get the page URL from within the game.

^ Next time you post a question, please provide all the relevant information so we don’t have to guess.

Given that, you should be able to use srcVal

http://unity3d.com/support/documentation/ScriptReference/Application-srcValue.html

which returns a relative path from the webpage to the executable - just work in reverse to find the webpage.

If for some reason that doesn’t work, you can always call a function or grab a snippet directly from the containing webpage. Take a look at the following:

http://unity3d.com/support/documentation/ScriptReference/Application.ExternalEval.html

http://unity3d.com/support/documentation/ScriptReference/Application.ExternalCall.html

I implemented a solution using ExternalEval method and made it publicly available:

It exposes a string GetValue(string key) function allowing to get the URL parameters very easily. Enjoy!