Colin Evans Active Member Licensed User Longtime User Jun 26, 2016 #1 Hi I've tried looking at some of the weather examples but never managed to get any working. so I've looked the Met Office Widget and wondered if its possible to display the results of that in my B4A app, as shown in the example The script generated by the met office widget is <code> <script type="text/javascript"> moWWidgetParams="moAllowUserLocation:true~moBackgroundColour:black~moColourScheme:grey~moDays:7~moDomain:www.metoffice.gov.uk~moFSSI:310012~moListStyle:vertical~moMapDisplay:none~moShowFeelsLike:true~moShowUV:true~moShowWind:true~moSpeedUnits:M~moStartupLanguage:en~moTemperatureUnits:C~moTextColour:white~moGridParams:weather,temperature,wind,feelslike,warnings~"; </script><script type="text/javascript" src="http://www.metoffice.gov.uk/public/pws/components/yoursite/loader.js"> </script><p>This <a href='http://www.metoffice.gov.uk/public/weather/forecast/?tab=map' target='_blank' >weather forecast</a> is generated by the <a href='http://www.metoffice.gov.uk/public/weather/components'>Met Office Weather Widget</a></p> </code> Attachments widget_example.png 35.2 KB · Views: 763
Hi I've tried looking at some of the weather examples but never managed to get any working. so I've looked the Met Office Widget and wondered if its possible to display the results of that in my B4A app, as shown in the example The script generated by the met office widget is <code> <script type="text/javascript"> moWWidgetParams="moAllowUserLocation:true~moBackgroundColour:black~moColourScheme:grey~moDays:7~moDomain:www.metoffice.gov.uk~moFSSI:310012~moListStyle:vertical~moMapDisplay:none~moShowFeelsLike:true~moShowUV:true~moShowWind:true~moSpeedUnits:M~moStartupLanguage:en~moTemperatureUnits:C~moTextColour:white~moGridParams:weather,temperature,wind,feelslike,warnings~"; </script><script type="text/javascript" src="http://www.metoffice.gov.uk/public/pws/components/yoursite/loader.js"> </script><p>This <a href='http://www.metoffice.gov.uk/public/weather/forecast/?tab=map' target='_blank' >weather forecast</a> is generated by the <a href='http://www.metoffice.gov.uk/public/weather/components'>Met Office Weather Widget</a></p> </code>
Colin Evans Active Member Licensed User Longtime User Jun 26, 2016 #2 Tried it with the following code but the results are the image attached <code> Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim webview1 As WebView End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("webview") webview1.LoadHtml($"<script type="text/javascript"> moWWidgetParams="moAllowUserLocation:false~moBackgroundColour:black~moColourScheme:grey~moDays:7~moDomain:www.metoffice.gov.uk~moFSSI:310012~moListStyle:vertical~moMapDisplay:none~moShowFeelsLike:true~moShowUV:true~moShowWind:true~moSpeedUnits:M~moStartupLanguage:en~moTemperatureUnits:C~moTextColour:white~moGridParams:weather,temperature,wind,feelslike,warnings~"; </script><script type="text/javascript" src="http://www.metoffice.gov.uk/public/pws/components/yoursite/loader.js"> </script><p>This <a href='http://www.metoffice.gov.uk/public/weather/forecast/?tab=map?locId=310012' target='_blank' ><span id='moWWSiteName' >Liverpool</span> weather forecast</a> is generated by the <a href='http://www.metoffice.gov.uk/public/weather/components'>Met Office Weather Widget</a></p>"$) End Sub </code> Attachments weview1.png 23.7 KB · Views: 795 Upvote 0
Tried it with the following code but the results are the image attached <code> Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim webview1 As WebView End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("webview") webview1.LoadHtml($"<script type="text/javascript"> moWWidgetParams="moAllowUserLocation:false~moBackgroundColour:black~moColourScheme:grey~moDays:7~moDomain:www.metoffice.gov.uk~moFSSI:310012~moListStyle:vertical~moMapDisplay:none~moShowFeelsLike:true~moShowUV:true~moShowWind:true~moSpeedUnits:M~moStartupLanguage:en~moTemperatureUnits:C~moTextColour:white~moGridParams:weather,temperature,wind,feelslike,warnings~"; </script><script type="text/javascript" src="http://www.metoffice.gov.uk/public/pws/components/yoursite/loader.js"> </script><p>This <a href='http://www.metoffice.gov.uk/public/weather/forecast/?tab=map?locId=310012' target='_blank' ><span id='moWWSiteName' >Liverpool</span> weather forecast</a> is generated by the <a href='http://www.metoffice.gov.uk/public/weather/components'>Met Office Weather Widget</a></p>"$) End Sub </code>
NJDude Expert Licensed User Longtime User Jun 26, 2016 #3 That code doesn't seem to work, if you save it and try to open it on a browser you will get the same results. Upvote 0
That code doesn't seem to work, if you save it and try to open it on a browser you will get the same results.
Colin Evans Active Member Licensed User Longtime User Jun 26, 2016 #4 NJDude said: That code doesn't seem to work, if you save it and try to open it on a browser you will get the same results. Click to expand... Thanks for the reply, the code was generated by the met office web site, so I've asked them the question, I'll keep it updated Upvote 0
NJDude said: That code doesn't seem to work, if you save it and try to open it on a browser you will get the same results. Click to expand... Thanks for the reply, the code was generated by the met office web site, so I've asked them the question, I'll keep it updated
Colin Evans Active Member Licensed User Longtime User Jun 27, 2016 #5 Colin Evans said: Thanks for the reply, the code was generated by the met office web site, so I've asked them the question, I'll keep it updated Click to expand... Met Office replied but only to say they weren't aware of any problems, so I now use this one from acuweather, which seems to work okay, <a href="http://www.accuweather.com/en/gb/new-brighton/ch45-0/weather-forecast/325626" class="aw-widget-legal"></a> <div id="awtd1467067750896" class="aw-widget-36hour" data-locationkey="325626" data-unit="f" data-language="en-us" data-useip="false" data-uid="awtd1467067750896" data-editlocation="true" data-lifestyle="fishing"></div><script type="text/javascript" src="http://oap.accuweather.com/launch.js"></script> Upvote 0
Colin Evans said: Thanks for the reply, the code was generated by the met office web site, so I've asked them the question, I'll keep it updated Click to expand... Met Office replied but only to say they weren't aware of any problems, so I now use this one from acuweather, which seems to work okay, <a href="http://www.accuweather.com/en/gb/new-brighton/ch45-0/weather-forecast/325626" class="aw-widget-legal"></a> <div id="awtd1467067750896" class="aw-widget-36hour" data-locationkey="325626" data-unit="f" data-language="en-us" data-useip="false" data-uid="awtd1467067750896" data-editlocation="true" data-lifestyle="fishing"></div><script type="text/javascript" src="http://oap.accuweather.com/launch.js"></script>