Passing a string from a web page

Is there any way to pass a string from a web page to any control (like HTMLview)

Can you explain more about what you want to do?

from a web page on my server, I need to extrapolate only few information, for example the temperature of some cities. It would be great for example if i could get the content of the console.log()

It’s still not clear what you are trying to do. Anything which you can output in console.log() can also be put into a control.

i would need to interact from my mobile APP with a WEBPAGE on a server and to exchange information between them.
From the App i want to navigate to the page of

  • country: UK
  • city: London
    and from that page i want to retrieve the temperature, humidity, inhabitants etc.
    What’s the best way?

The best way is to provision an API that outputs the data you need (most likely from a database or even scraped from another site) in a format such as JSON that can then be consumed by your app.

You may also want to look at an API that already exist from NOAA that provides detailed weather data by everything you can imagine. I used it about 10 years ago, and the app I wrote is still running against it.

I think this is the one: https://www.ncdc.noaa.gov/cdo-web/webservices/v2

1 Like

Yeah, what Gary says. I also seem to remember there was an set of examples in the starter files for AppStudio.

Hi and thanks all, but i used the weather just to make a clearer example.
What i need to pass to App are some values (texts and numbers) contained in some variables from my webpages.
There are some development tools allowing to pass a webstrings from a webpage to the app, i want to understand if there is a similar possibility in appstudio

Ahh, I found the old code - here’s the API url - m.ObsURL = ‘http://w1.weather.gov/xml/current_obs/’ + stations.station + ‘.xml’

where the stations is a list of names for every NOAA weather station. EG, KTPA is Tampa Bay at Ruskin.

station,name,location,obstime,time,temperate,humidity,dewpoint,weather,direction,speed,pressure,visibility,heatindex,windchill,iconurl,icon,downloaded
"KTPA","Tampa Intl","Tampa, Tampa International Airport, FL","Thu, 15 Mar 2018 21:53:00 -0400","Last Updated on Mar 15 2018, 9:53 pm EDT",55.0,47.0,35.1,"Fair","Northwest",4.6,30.16,10.00,0.0,54.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nskc.jpg",3/15/2018 10:16:57 PM
"KVDF","NE Tampa","Tampa, Vandenberg Airport, FL","Thu, 15 Mar 2018 21:55:00 -0400","Last Updated on Mar 15 2018, 9:55 pm EDT",43.0,76.0,35.6,"Fair","North",0.0,30.16,10.00,0.0,0.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nskc.jpg",3/15/2018 10:17:09 PM
"KMCF","Ft. MacDill","Macdill Air Force Base, Fl., FL","Thu, 15 Mar 2018 21:56:00 -0400","Last Updated on Mar 15 2018, 9:56 pm EDT",53.0,60.0,39.2,"Fair","North",5.8,30.15,10.00,0.0,51.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nskc.jpg",3/15/2018 10:17:17 PM
"KPIE","Clearwater","St. Petersburg/Clearwater Airport, FL","Thu, 15 Mar 2018 21:53:00 -0400","Last Updated on Mar 15 2018, 9:53 pm EDT",54.0,57.0,39.0,"Fair","North",0.0,30.16,10.00,0.0,0.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nskc.jpg",3/15/2018 10:17:28 PM
"KBKV","Brooksville","Brooksville, Hernando County Airport, FL","Thu, 15 Mar 2018 21:53:00 -0400","Last Updated on Mar 15 2018, 9:53 pm EDT",40.0,70.0,30.9,"Fair","North",0.0,30.16,10.00,0.0,0.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nskc.jpg",3/15/2018 10:17:37 PM
"KEYW","Key West","Key West International Airport, FL","Thu, 15 Mar 2018 21:53:00 -0400","Last Updated on Mar 15 2018, 9:53 pm EDT",64.0,70.0,54.0,"Fair","",0.0,30.12,0.00,0.0,0.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nskc.jpg",3/15/2018 10:17:50 PM
"KATL","Atlanta","Atlanta, Hartsfield - Jackson Atlanta International Airport, GA","Thu, 15 Mar 2018 21:52:00 -0400","Last Updated on Mar 15 2018, 9:52 pm EDT",58.0,29.0,26.1,"A Few Clouds","Southwest",9.2,29.99,10.00,0.0,56.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nfew.jpg",3/15/2018 10:18:00 PM
"KNYC","New York","New York City, Central Park, NY","Thu, 15 Mar 2018 21:51:00 -0400","Last Updated on Mar 15 2018, 9:51 pm EDT",38.0,68.0,28.0,"Overcast","West",10.4,29.63,10.00,0.0,31.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","novc.jpg",3/15/2018 10:18:10 PM
"KDFW","Dallas","Dallas/Fort Worth International Airport, TX","Thu, 15 Mar 2018 20:53:00 -0500","Last Updated on Mar 15 2018, 8:53 pm CDT",71.0,53.0,53.1,"Mostly Cloudy and Breezy","South",24.2,29.75,10.00,0.0,0.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nbkn.jpg",3/15/2018 10:18:20 PM
"KORD","Chicago","Chicago, Chicago-O'Hare International Airport, IL","Thu, 15 Mar 2018 20:51:00 -0500","Last Updated on Mar 15 2018, 8:51 pm CDT",32.0,75.0,25.0,"A Few Clouds","Northeast",8.1,29.98,10.00,0.0,25.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nfew.jpg",3/15/2018 10:18:30 PM
"KDEN","Denver","Denver, Denver International Airport, CO","Thu, 15 Mar 2018 19:53:00 -0600","Last Updated on Mar 15 2018, 7:53 pm MDT",44.0,79.0,37.9,"Overcast and Windy","North",26.5,29.51,10.00,0.0,34.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","nwind.jpg",3/15/2018 10:18:40 PM
"KSDM","San Diego","San Diego, Brown Field Municipal Airport, CA","Thu, 15 Mar 2018 18:53:00 -0700","Last Updated on Mar 15 2018, 6:53 pm PDT",54.0,69.0,44.1,"A Few Clouds","West",4.6,30.04,10.00,0.0,53.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","few.jpg",3/15/2018 10:18:50 PM
"KSEA","Seattle","Seattle, Seattle-Tacoma International Airport, WA","Thu, 15 Mar 2018 18:53:00 -0700","Last Updated on Mar 15 2018, 6:53 pm PDT",51.0,35.0,24.1,"Partly Cloudy","North",9.2,29.73,10.00,0.0,48.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","sct.jpg",3/15/2018 10:19:00 PM
"PHJH","Hawaii","Lahaina - West Maui, HI","Thu, 15 Mar 2018 15:50:00 -1000","Last Updated on Mar 15 2018, 3:50 pm HST",82.0,62.0,68.0,"A Few Clouds","North",5.8,29.97,15.00,85.0,0.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","few.jpg",3/15/2018 10:19:10 PM
"PAOM","Alaska","Nome, Nome Airport, AK","Thu, 15 Mar 2018 17:53:00 -0800","Last Updated on Mar 15 2018, 5:53 pm AKDT",5.0,91.0,3.0,"Overcast","Northeast",5.8,30.02,8.00,0.0,-6.0,"[http://forecast.weather.gov/images/wtf/small/](http://forecast.weather.gov/images/wtf/small/)","ovc.jpg",3/15/2018 10:19:20 PM

You should be able to track down the documentation from this info.

Have fun. It’s a great API.

Gary

Is there any possibility to get/set a value inside a HTMLView with any instruction like

HTMLView.document.getElementById(“IdOfSomething”).innerHTML = “NEW TEXT HERE”

I made some unsuccessful tries :frowning:

Yes, this will work:
HTMLview1.innerHTML="Hello World"

https://wiki.appstudio.dev/HTMLView

is there any way to change only a text inside, for example:
< p id=‘txt’ >CHANGE THIS TEXT ONLY PLEASE< /p >
I need this to exchange data with an HTML file in the assets to use openlayers for Maps, so it would be good if i can pass some data like longitude and latitude with an instruction like:
HTMLView.document.getElementById(“newcoords”).innerHTML = “45.123455, 14.2478”

Is the text currently in the HTMLview from another site?

HTMLview is a wrapper for an HTML iframe element. Text which comes from another site cannot be read or modified due to cross origin restrictions.

yes from another site
ok i see, thank you

I solved this problem of passing string through html pages by simply using localStorage :slight_smile: