0

How would one create a URL link (in firefox say) that would automatically just show the latest image for wind direction from this site. The issue is that you need to click on a tab in the page to see the latest image, and I'm not sure how this works.

The HTML for the link on the "24 Hour Wind" tab on the page is as follows below:

<a href="javascript:void(null);" title="24 hour Wind">24 hour Wind</a>

The page itself is here:

http://www.bom.gov.au/jsp/watl/weather/obs.jsp?graph=all_obs&station=40211

My goal is to be able to:

a) create a link directly to the latest image in firefox b) put this link in one of my own web pages where I compile all key pieces of info I want to see in one page

Greg
  • 34,042
  • 79
  • 253
  • 454
  • Do you want a link to the image itself, or a link to the page with the image tab opened? – Jeff Aug 04 '14 at 22:41

1 Answers1

1

If you "view source" on that page, you see the image is represented by

<div class="tabbertab">
<h2>24 hour Wind</h2>   

<p><img src="/tmp/current_obs/40211_wind.png" alt="24 hour Wind Speed and Direction graph" title="24 hour Wind Speed and Direction graph" /></p>

a) create a link directly to the latest image in firefox

If you want to open that tab on the page, you will need a way to click the div with the h2 on it with the text 24 hour wind. You can accomplish that with a Bookmarklet (credit to @Jeff for pointing that out in the comments).

If you just want to link to the image (without the rest of the page, you could link to

http://www.bom.gov.au/tmp/current_obs/40211_wind.png

b) put this link in one of my own web pages where I compile all key pieces of info I want to see in one page

You can directly load that image from

http://www.bom.gov.au/tmp/current_obs/40211_wind.png

I suspect that the 40211 part changes from time-to-time. Unless you know how that number is generated, the safe bet would be to parse the page, find the current relative link, and change it to an absolute link.

As always when scraping data from a website, make sure you are following the appropriate terms of use policy.

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553
  • thanks Eric - do you happen to know how the "href="javascript:void(null);" manages to trigger showing the image? Any thoughts on whether you could embed javascript in a firefox bookmark to do the parsing? (or do you really need your own app or website to how such intelligent parsing code in?) – Greg Aug 04 '14 at 22:49
  • It's using a JavaScript library called Tabber to show the image on each tab. http://www.bom.gov.au/watl/interface/tabs/tabber.js. You cannot cause JavaScript to run from a bookmark (without a plugin, that each user would need). As far as I know, the JavaScript must be run from their page. – Eric J. Aug 04 '14 at 22:52
  • @Jeff: Cool, had not seen that before. – Eric J. Aug 04 '14 at 23:36