1 2 Previous Next 15 Replies Latest reply on Jun 26, 2013 8:06 PM by philmodjunk

    Web Viewer with data:text/html

    jimlongo

      Title

      Web Viewer with data:text/html

      Post

           Is the ability to view html and javascript web content in the Web Viewer in the form

           data:text/html,<html>

           a feature only available as of Filemaker Pro v12 ?

            

            

        • 1. Re: Web Viewer with data:text/html
          schamblee

               Here is a clock sample using html and java script in webviewer        https://www.sugarsync.com/pf/D9559058_790_720690362

          • 2. Re: Web Viewer with data:text/html
            jimlongo

                 Cool, but my question is: Does this require FMP12?

            • 3. Re: Web Viewer with data:text/html
              schamblee

                   I don't think so.  The clock sample was disigned for a version of filemaker prior to 12.  Also I found a post on here using the clock sample in FM10.  Here is a link to that post. How can display real time clock FileMaker 10 Advance

                   I'm not 100% sure because I only have 12.

              • 4. Re: Web Viewer with data:text/html
                jimlongo

                     The reason I ask is that I have written a script to use the Google Maps API.

                     The script returns the following text, which will display as a streetmap with 6 pins in a normal web browser.

                     However when displayed in the web viewer it displays a blank window.

                     Here is the output of the script , (sorry for the formatting).  So i was starting to think that my FM11 wasn't capable of displaying this type of content.

                      

                      

                     data:text/html,<!DOCTYPE html>  

                      <html>

                     <head>

                     <meta charset='utf-8'>

                     <title></title>

                      <meta name='viewport' content='initial-scale=1.0, user-scalable=no'>

                      <style type='text/css'>

                      html { height: 100% }body { height: 100%; margin: 0; padding: 0 }#map-canvas { height: 100% }</style>

                      <script src='https://maps.googleapis.com/maps/api/js?key=AIzaSyDfuEKBcnNRGdlw4_YYCZ0UL9rkxV1jtO4&sensor=false'></script>

                      <script>

                       var geocoder;

                       var map;

                       function initialize() {

                          geocoder = new google.maps.Geocoder();

                          var latlng = new google.maps.LatLng( 43.670234 , -79.386737 );

                          var mapOptions = { zoom: 11, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }

                          map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

                          var locations = [ 

                              '229 Ashworth Avenue, Toronto ON',

                              '1112 Queen Street East, Toronto ON',

                              '889 Yonge Street, Toronto ON',

                              '1711 Melrose Avenue, Toronto ON',

                              '2500 Yonge Street, Toronto ON',

                              '45 First Avenue, Toronto ON'

                         ]; 

                          var i; 

                          for (i = 0; i < locations.length; i++) {  

                              geocoder.geocode( { 'address': locations[i] }, function(results, status) {  

                              map.setCenter(results[0].geometry.location);

                              var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location });

                         });

                       }

                     }  

                          google.maps.event.addDomListener(window, 'load', initialize);  

                      </script> 

                      </head>

                       <body>

                         <div id='map-canvas'>

                         </div>

                       </body>

                     </html>

                      

                • 5. Re: Web Viewer with data:text/html
                  schamblee

                       Check this website out about Google Route Mapping, there is a demo app on that site.

                  http://www.filemakerhacks.com/?p=3802

                  • 6. Re: Web Viewer with data:text/html
                    jimlongo

                         Thanks, but that example doesn't use the api, it just uses a google URL with a variable tacked on the end.

                         My code that uses the API works on its own in a web browser, it doesn't work in WebViewer, that's what I'm asking about.

                    • 7. Re: Web Viewer with data:text/html
                      schamblee

                           Here is another sample that works in a webviewer.

                      https://www.sugarsync.com/pf/D9559058_790_962856248

                            

                           I forgot you need a version that would work on 11.  I will try to find an example for fm11. 

                      • 8. Re: Web Viewer with data:text/html
                        schamblee

                             Your script worked for me in 12.   I created a field named html and pasted your script into this field.    Then I created a webviewer with the html field as the source.

                        • 9. Re: Web Viewer with data:text/html
                          jimlongo

                               Okay, thanks for that.

                               Maybe there's a bug in v11.

                               Are you on a Mac or PC?

                          • 10. Re: Web Viewer with data:text/html
                            schamblee

                                 I tested on Mac and PC.  I don't think its a bug.  Have you tried using a field like I described above?  I been playing around with the webviewer for awhile (off and on for a few months).  I believe it just a matter of getting the information in the correct format, for the webviewer to recognise.   Notice the sample from the other post has quotes around the whole script. 

                                 I haven't figured out every aspect of getting html working in the webviewer, but I believe it just a matter of putting quotes in the correct place. It doesn't require the quotes if you use it from a field. 

                            • 11. Re: Web Viewer with data:text/html
                              jimlongo

                                   Yes i've done just as you have.  That is the actual text from the field that is displayed in the webviewer.

                                   Ive written a script which outputs its text to a field. I'm aware of the pitfalls of double quotes for the script and inside quotes, that's why my whole script uses single quotes, it's easier than escaping double quotes.

                                   At any rate, since I output to a text field I can also edit the field and nothing I've tried is working.

                                   So if  that text in your field works, and in mine doesn't and the only other difference is v11 vs v12 I'd think it's safe to say there's a bug. Unless you can think of another factor.

                              • 12. Re: Web Viewer with data:text/html
                                schamblee

                                     I downloaded Filemaker 11 Trial Version Created a database with an html field and a webview using the html field.  Copy the script you posted on the internet and pasted it in the html field, and It's running. 

                                     Here is a link to that database

                                https://www.sugarsync.com/pf/D9559058_70463017_89678

                                     This test was done on a windows 7 computer.

                                • 13. Re: Web Viewer with data:text/html
                                  jimlongo

                                       That's interesting, I downloaded your database and it exhibits the same behaviour as mine does.

                                       The progress bar goes about halfway across the webviewer and it renders a blank page.

                                       That's on 3 Macs all running Lion 10.7.5- a laptop, an imac and a mac pro.

                                  • 14. Re: Web Viewer with data:text/html
                                    jimlongo

                                         I just downloaded FM12 on my Mac and the database file displays the map with pins immediately.

                                         There must be some bug with FM11 Pro Mac and javascript in the web viewer.

                                    1 2 Previous Next