Amit,

WebViewClient.onPageStarted() is the most reliable and does not depend on 
JS.

-John

On Wednesday, March 7, 2012 7:22:47 AM UTC-5, Amit wrote:
>
> Thanks John for response.
>
> With my response " It is not necessary to be same url as it being loaded 
> from." I didn't mean variable url in  Moktarul's solution can contain wrong 
> value. I was meant: for callback, this info is passed as string variable. 
> This argument carries actual url value, if loaded page is written by us. 
> But think of situation, any malicious page is getting loaded and page calls 
> this exposed JS function. Malicious page writer may not intend to pass 
> correct url information. 
> I am looking for solution, if currently loaded url information can be 
> retrieved inside JS callback from webkit/android SDK , then this info will 
> be authentic.
>
> I hope you understand the problem.
>
> -Amit 
>
> On Tuesday, 6 March 2012 18:20:10 UTC+5:30, John Purcell wrote:
>>
>> Amit,
>>
>>
>>> But i think, if android API provides this infromation, it will be 
>>> reliable information as   android known which url it is currently loading. 
>>>
>>
>> This is incorrect, *webkit* knows what url is authoritatively being 
>> loaded (not necessarily Android). The webkit/JS container bridge is 
>> synchronous while the communication between webkit and the various android 
>> callbacks are asynchronous for the most part. (i.e. In general, Moktarul's 
>> solution is correct if you want the currently loaded url (top level) from 
>> JavaScript).
>>   
>>
>> On Tuesday, March 6, 2012 1:13:02 AM UTC-5, Amit wrote:
>>>
>>> I think you code snippet has  currentUrl() as JS exposed function. Is 
>>> there anyway to get urk infromation from android API. 
>>> Android.currentUrl(url), caller can pass anystring. It is not necessary to 
>>> be same url as it being loaded from.
>>> But i think, if android API provides this infromation, it will be 
>>> reliable information as   android known which url it is currently loading. 
>>>
>>> On Tuesday, 6 March 2012 10:39:42 UTC+5:30, moktarul anam wrote:
>>>>
>>>> Hi Amit. 
>>>>
>>>> in html header 
>>>> <script>
>>>> function onload(){
>>>>     var url = window.loacation;
>>>> alert(url);
>>>> Android.currentUrl(url);
>>>> } 
>>>>
>>>> </script>
>>>>
>>>> <body onload="onload()">
>>>>
>>>> Moktarul 
>>>>
>>>>
>>>> On Monday, 5 March 2012 18:03:30 UTC+5:30, Amit wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am exposing java script function from my webview. This Java script 
>>>>> function  is called by webcore thread on-page-loading inside webview. Is 
>>>>> there any way to retrieve current loaded url inside called Java script 
>>>>> function?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>
>>>> On Monday, 5 March 2012 18:03:30 UTC+5:30, Amit wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am exposing java script function from my webview. This Java script 
>>>>> function  is called by webcore thread on-page-loading inside webview. Is 
>>>>> there any way to retrieve current loaded url inside called Java script 
>>>>> function?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>
>> On Tuesday, March 6, 2012 1:13:02 AM UTC-5, Amit wrote:
>>>
>>> I think you code snippet has  currentUrl() as JS exposed function. Is 
>>> there anyway to get urk infromation from android API. 
>>> Android.currentUrl(url), caller can pass anystring. It is not necessary to 
>>> be same url as it being loaded from.
>>> But i think, if android API provides this infromation, it will be 
>>> reliable information as   android known which url it is currently loading. 
>>>
>>> On Tuesday, 6 March 2012 10:39:42 UTC+5:30, moktarul anam wrote:
>>>>
>>>> Hi Amit. 
>>>>
>>>> in html header 
>>>> <script>
>>>> function onload(){
>>>>     var url = window.loacation;
>>>> alert(url);
>>>> Android.currentUrl(url);
>>>> } 
>>>>
>>>> </script>
>>>>
>>>> <body onload="onload()">
>>>>
>>>> Moktarul 
>>>>
>>>>
>>>> On Monday, 5 March 2012 18:03:30 UTC+5:30, Amit wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am exposing java script function from my webview. This Java script 
>>>>> function  is called by webcore thread on-page-loading inside webview. Is 
>>>>> there any way to retrieve current loaded url inside called Java script 
>>>>> function?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>
>>>> On Monday, 5 March 2012 18:03:30 UTC+5:30, Amit wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am exposing java script function from my webview. This Java script 
>>>>> function  is called by webcore thread on-page-loading inside webview. Is 
>>>>> there any way to retrieve current loaded url inside called Java script 
>>>>> function?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>
>> On Tuesday, March 6, 2012 1:13:02 AM UTC-5, Amit wrote:
>>>
>>> I think you code snippet has  currentUrl() as JS exposed function. Is 
>>> there anyway to get urk infromation from android API. 
>>> Android.currentUrl(url), caller can pass anystring. It is not necessary to 
>>> be same url as it being loaded from.
>>> But i think, if android API provides this infromation, it will be 
>>> reliable information as   android known which url it is currently loading. 
>>>
>>> On Tuesday, 6 March 2012 10:39:42 UTC+5:30, moktarul anam wrote:
>>>>
>>>> Hi Amit. 
>>>>
>>>> in html header 
>>>> <script>
>>>> function onload(){
>>>>     var url = window.loacation;
>>>> alert(url);
>>>> Android.currentUrl(url);
>>>> } 
>>>>
>>>> </script>
>>>>
>>>> <body onload="onload()">
>>>>
>>>> Moktarul 
>>>>
>>>>
>>>> On Monday, 5 March 2012 18:03:30 UTC+5:30, Amit wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am exposing java script function from my webview. This Java script 
>>>>> function  is called by webcore thread on-page-loading inside webview. Is 
>>>>> there any way to retrieve current loaded url inside called Java script 
>>>>> function?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>
>>>> On Monday, 5 March 2012 18:03:30 UTC+5:30, Amit wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am exposing java script function from my webview. This Java script 
>>>>> function  is called by webcore thread on-page-loading inside webview. Is 
>>>>> there any way to retrieve current loaded url inside called Java script 
>>>>> function?
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to