March 19, 200817 yr Any suggestions to if it is possible to scrape data from javascript variables using the web viewer? What I am trying to is to pick up the longitude and latitude from this page: http://130.225.211.158/utmkort/koordinatfinder.htm You see, when the map is clicked, the values are stored in javascript variables - but how can I "read" these from within the web viewer to pick the up and put them inside two filemaker fields?
March 19, 200817 yr Static HTML can be scraped with GetLayoutObjectAttribute( "myWevViewer" ; "source" ). What you're describing though, I believe would require a plugin such as Fusion Reactor or MBS. http://mbs.geistinteractive.com/node/7 http://fusionplugins.com/reactor/
March 20, 200817 yr Author Thank you for the reply. MBS will probably solve this problem, but I will prefer to find a solution not involving plugins. The solution I am looking for needs to be fully working on both mac and win and should be possible to distribute in a standalone solution. BTW: I have full control over the html-document so perhaps the solution in not in Filemaker, so to say, but in the html-document. Could some clever javascript put the values dynamically in another document as text and I could then scrape the info from this. Any ideas out there? Perhaps I should try a javascript forum too, regarding this.
March 20, 200817 yr I don't think it's possible without a plugin, at least not on the client side. It seems to be a security feature within javascript - not allowing it to interact with the rest of the system. But if you do find a solution, please let us know. If you have control over what's happening on the server side, and can make the site return a new html (or preferably, an xml) document as a result of a request being made, that would be a different story. Working entirely within client-side javascript, you might consider just copying and pasting - see: http://fmforums.com/forum/showtopic.php?tid/192504/post/277911/#277911 But I think this would require you to change the script, so that the results are written to the document itself, instead of to form fields.
March 20, 200817 yr The problem is that, although you can interact with a web viewer object, FileMaker doesn't have any way to "know" that you have done so. If you do find a solution, please post it.
March 23, 200817 yr Author Thank you all for the suggestions. I have now solved it and would like to describe the solution as others probably can use the idea. It is as a matter of fact quite simple, though it is necessary, that you have access to the html document to adjust this. I had to somehow to get the values from the javascript variables written to something I could scrape from. I long thought about the idea of making an intermediary html document where the values were written to on the fly, but could not get the idea to how to build this system. Then, one late night, I got a break through: The web viewer makes it possible to scrape from the html source - OR from the URL... - could I place the values in the URL line, without evoking a reload of the page? Then I could scrape the URL line and parse the values from here. Yup, it could be done! To get the latitude/longitude values in the url, I made a small amendment to my javascript on the html document: document.location = 'http://130.225.211.158/utmkort/webkoord.htm' + '#long' + longitude+'lati'+ latitude; (longitude and latitude are the names of my two javascript variables.) This line takes the original url and puts a string like this after it: #long12.10693359375lati55.906115026011605 The hash-sign is important. Because of this nothing happens even though the page does reload. And I have a nice string to parse, picking up the longitude and latitude value. A script in Filemaker first scrapes the URL and put the line in a field, and then I parse the string, picking up the two numbers, and we're home. Heureka!
November 30, 201510 yr Hi, I'd really love some help implementing a similar problem I have, if you're still active on this forum???
November 30, 201510 yr If you look at Chr. Lange's profile, you will see that he last visited this forum in January, 2010. You would be better off starting a new thread giving the details of your specific problem.
November 30, 201510 yr Hi twelve and welcome to the FM Forums, 12 minutes ago, doughemi said: You would be better off starting a new thread giving the details of your specific problem. I agree with Doug, lots of changes in the last 7 years. FileMaker Pro app being used then was probably 8.5 or 9 then. Your problem might be similar, but it is better for you put it into your own words. Fill free to attach a file or screen shots to help explain you need. Lee
December 1, 201510 yr Thanks all, managed to get it sorted now, through picking up various nuggets of information here and on other forums.
Create an account or sign in to comment