About:blank page

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

About:blank page

Post by francof » Mon Dec 15, 2014 12:24 pm

Hi all,
I've used this lesson http://lessons.runrev.com/m/4069/l/2283 ... er-control
to connect my app to the internet.
I've tested it on the emulator and 5 different smartphones. all works fine in all of them except for 2 devices: samsung galaxy note, both. where I've the strange, same behavior:

first, in a card I set the url and put it into a global "gUrl" to make a reserch with google search:

Code: Select all

put empty into gUrl
   put the selectedText of fld "fldPiattiAbbinati" into tRicettaDaCercare
   replace " " with "+" in tRicettaDaCercare                                                                          --sostituisce lo spazio tra le parole con il car. +
   put "http://www.google.it/search?q=ricette+"& tRicettaDaCercare into gUrl
   
   go to card "cdWeb"
then opening another card, create the browser control:

Code: Select all

on preOpenCard
   if the environment is not "mobile" then
      exit preOpenCard
   end if
   
   -- Create our browser control and store the id
   mobileControlCreate "browser"
   put the result into sBrowserId
   
   -- Native controls start off invisible
   mobileControlSet sBrowserId, "visible", "true"
   
   -- Set up a suitable initial url
   mobileControlSet sBrowserId, "url", gUrl
   
   -- Make sure everything is the right size
   resizeStack
end preOpenCard
at this point I see all the google search results, and selecting one of them, when testing on the galaxy note, a white page with "about:blank" into the url address is open.

any idea about it?
best
franco

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: About:blank page

Post by dave.kilroy » Mon Dec 15, 2014 4:00 pm

francof - I would check (with an answer statement) what exactly is selected ready to be displayed on the next card - it may be that Samsung treat some characters differently thus spoiling your URL...

BTW there are lots of things missing in your code (declaring the global, setting the rect of the browser etc) which I'm assuming you have properly in your stack - because it runs OK on other devices right?

Dave
"...this is not the code you are looking for..."

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: About:blank page

Post by LCNeil » Mon Dec 15, 2014 4:19 pm

Hi All,

There is a known bug with certain Android devices displaying an about:blank page in a browser instance. A report on this can be found here-

http://quality.runrev.com/show_bug.cgi?id=14085

I would recommend adding a comment to the report as this will inform our QC team that this issue is still affecting our users.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: About:blank page

Post by francof » Mon Dec 15, 2014 5:28 pm

Hi Neil,
runrevneil wrote:...
I would recommend adding a comment to the report as this will inform our QC team that this issue is still affecting our users.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--
done, I hope correctly.

Hi Dave,
dave.kilroy wrote:francof - I would check (with an answer statement) what exactly is selected ready to be displayed on the next card
...
here a pair of images of the variables:
Immagine.jpg
"gUrl" variable is the global containing the full url to find, the last "tRicettaDaCercare" containing the content of the selected row of a field.
dave.kilroy wrote: ...
BTW there are lots of things missing in your code (declaring the global, setting the rect of the browser etc) which I'm assuming you have properly in your stack - because it runs OK on other devices right?

Dave
yes, it's right. anyway, below the code, into the script of a button:

Code: Select all

global gUrl                                        -- contiene l' url completo x la ricerca nel web da passare alla card cdWeb

on mouseUp
   if the hilitedline of fld "fldPiattiAbbinati" is empty then
      answer "Attenzione! Selezionare una ricetta dall'elenco dei " & fld lblTitoloPiatti
      exit to top
   end if
   
   answer "Permettere all'applicazione di connettersi ad internet? " with "No" or "Si"
   if it is "No" then
      exit to top
   end if
   

   put the selectedText of fld "fldPiattiAbbinati" into tRicettaDaCercare
   replace " " with "+" in tRicettaDaCercare                                                                          --sostituisce lo spazio tra le parole con il car. +
   replace "^" with "'" in tRicettaDaCercare                                                                          --sostituisce l'eventuale car. ^ con l'apostrofo classico '
   put "http://www.google.it/search?q=ricette+"& tRicettaDaCercare into gUrl
   
   go to card "cdWeb"
end mouseUp
and into the card "cdWeb" script:

Code: Select all

-- We use this variable to store the id of the UIWebView native
-- control.
global gUrl                                        -- contiene l' url completo x la ricerca nel web creato nello script del tasto btnWebRicetta
local sBrowserId

on preOpenCard
   answer gUrl
   if the environment is not "mobile" then
      exit preOpenCard
   end if
   
   -- Create our browser control and store the id
   mobileControlCreate "browser"
   put the result into sBrowserId
   
   -- Native controls start off invisible
   mobileControlSet sBrowserId, "visible", "true"
   
   -- Set up a suitable initial url
   --mobileControlSet sBrowserId, "url", "http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode"
   mobileControlSet sBrowserId, "url", gUrl
   
   -- Make sure everything is the right size
   resizeStack
end preOpenCard

on closeCard
   if the environment is not "mobile" then
      exit closeCard
   end if
   
   -- Destroy the control, if we fail to do this native UIViews
   -- will just accumulate
   mobileControlDelete sBrowserId
end closeCard

on resizeStack
   if the environment is not "mobile" then
      exit resizeStack
   end if
   
   -- Adjust the size of the URL entry field
   set the rect of field "URL" to the left of field "URL", the top of field "URL", the width of this card - 4, the bottom of field "URL"
   
   -- Adjust the size of the browser view
   set the rect of group "Browser" to the left of group "Browser", the top of group "Browser", the width of this card - 4, the height of this card - 40
   
   -- Adjust the status field
   set the rect of field "Status" to 4, the bottom of group "Browser" + 4, the width of this card - 4, the height of this card - 4
   
   -- Now adjust the control itself
   mobileControlSet sBrowserId, "rect", the rect of group "Browser"
end resizeStack

--------

-- This message is received after a request has been allowed and
-- loading is starting
on browserStartedLoading pUrl
   put "Sto  caricando:  " && pUrl into field "Status"
end browserStartedLoading

-- This message is received when a page has been completely
-- loaded and is displayed to the user
on browserFinishedLoading pUrl
   put "Caricato:  " && pUrl into field "Status"
   put pUrl into field "Url"
end browserFinishedLoading

-- This message is received when a new url is requested. Passing it
-- causes the load to go ahead, otherwise it does not.
on browserLoadRequest pUrl, pReason
   answer "Vuoi  caricare:" && pUrl with "Yes" and "No"
   if it is "Yes" then
      pass browserLoadRequest
   else
      put "Rifiutato:  " && pUrl into field "Status"
   end if
end browserLoadRequest

--------

-- This handler is invoked by our Back/Forward/Stop/Refresh buttons
-- we just pass the request onto the control.
command doAction pAction
   if the environment is not "mobile" then
      exit doAction
   end if
   
   mobileControlDo sBrowserId, pAction
end doAction

-- This handler is invoked when the url field is closed after editing.
-- It causes a new url to be requested
command goUrl pUrl
   if the environment is not "mobile" then
      exit goUrl
   end if
   
   mobileControlSet sBrowserId, "url", pUrl
end goUrl
the Answer msg:
Attachments
answer.jpg

Post Reply