Jump to content
Sign in to follow this  
MyBigFM9Project

Insert modified HTML code back into WebViewer, with JS and images

This topic is 1948 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi, I have run into a standstill here where maybe someone could point me in the right direction.  This is for a large personal project that I have been working on for a few years.  I have considered all the possibilities with FM and looked at add-ons, but this is the first time I think I cannot find an answer. 

 

I have used the Webviewer just to navigate through a website to get to a certain page to scrape.  That works great.

 

In this usage, I want to do more than just scrape.  I want to load the page in FM (on the webviewer), take the "content" (client-side HTML), run it through a comparative analysis in FM, append text to it line-by-line, and then reload that back into the Webviewer. 

 

The only problem is that the reload process always causes the Webviewer to get rid of any other website files, in particular Javascript files, which this web page needs in order work correctly.

 

Right now I am working around this by using an earlier (alternate) version of my script.  I first open the web page using the web browser Opera, cut and paste the HTML from that using the Windows clipboard, dump it into a global text field in FM, run my script on that, then cut and paste that back into Opera and click Update, which replaces the HTML but leaves everything else alone. 

 

Is there any way I could use the Filemaker Webviewer (or possibly some plug-in) to do similar - only replace the HTML, but leave all the other website files (javascript) as-is??  It has to be using some sort of web viewer, as I will manually be selecting options from the updated web page and submitting to a local web server.

 

Thanks

Chris

Share this post


Link to post
Share on other sites

Well never mind, it wasn't anything to do with Filemaker.  Upon further investigation it was because HTML pages use relative paths to the files on the server, so I changed them to absolute paths.  Now when the HTML originates from Filemaker's Webviewer, it properly loads most of the files. There are still some minor issues, not related to the usage of the Webviewer, so I will go to other places to resolve those.

Share this post


Link to post
Share on other sites

Okay, just to update in case anyone is following along.  What worked out for me was to incorporate the HTML "Base" tag into the header of the HTML file which I am using Filemaker to edit.  Probably nobody else in the world is doing exactly what I did, but that made it work perfectly.  So I ended up ditching the Absolute Paths and just using HTML's Base tag to establish the correct Relative path back to the web server after the original relative path was broken (from it being loaded up and originating from FM this time) after the edits/enhancements. :)

 

I am only using FM9 ADV and 360Works Scriptmaster (free).  That all that was necessary.

Share this post


Link to post
Share on other sites

This topic is 1948 days old. Please don't post here. Open a new topic instead.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By St3v1e
      Hi,
      As a complete novice to FMP, I'm attempting my very first database. We rely on storing our contracts on Google & Dropbox. I've been trying to either embed the pdf's into a "tab", or (my preferred option) to have an "Add URL" button to link to the online pdf.
      I tried adding a field and copying and pasting the URL, but it's not clickable, and I'd need to add another field for each pdf/contract.
      Is there a better more efficient way to do this?
      Thanks
      Steve
    • By MonkeybreadSoftware
      Recently a client asked how to leverage JavaScript in FileMaker to do a specific calculation. For this blog post we replace the client's function with a CRC function to show you how to do it.
      Up until a few weeks ago we would have pointed to loading JavaScript in a web viewer and using WebView.RunJavaScript to run the JavaScript. But now we would point to WebView.Evaluate and just run it. See the example script in our documentation for this CRC function.
      With MBS FileMaker Plugin in version 10.0 we got our own JavaScript functions using the DukTape engine. We have an example in the documentation to run the CRC function right in a Let command and the JS.Evaluate command. But instead of initializing it each time in a Let statement, you may prefer to split this into three scripts, so you do the initialization only once.
      he following script initializes the JavaScript environment once and uses a call to JS.Evaluate to pass the JavaScript functions:
       
      If [ Length($$js) = 0 ] 
      Set Variable [ $$js ; Value: MBS( "JS.New" ) ] 
      Set Variable [ $r ; Value: MBS( "JS.Evaluate"; $$js; 
      "function makeCRCTable(){
              var c;
              var crcTable = [];
              for(var n =0; n < 256; n++){
                      c = n;
                      for(var k =0; k < 8; k++){
                              c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
                      }
                      crcTable[n] = c;
              }
              return crcTable;
      }
       
      function crc32(str) {
              var crcTable = crcTable || (crcTable = makeCRCTable());
              var crc = 0 ^ (-1);
       
              for (var i = 0; i < str.length; i++ ) {
                      crc = (crc >>> 😎 ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF];
              }
       
              return (crc ^ (-1)) >>> 0;
      };") ] 
      End If
       
      As you see we store the JavaScript environment in a global $$js variable, so we can refer to it everywhere in this file. Instead of letting JS.Evaluate define the functions, we could alternatively use JS.AddFunction if you prefer:
       
      If [ Length($$js) = 0 ] 
      Set Variable [ $$js ; Value: MBS( "JS.New" ) ] 
      Set Variable [ $r ; Value: MBS( "JS.AddFunction"; $$js; "makeCRCTable"; "function makeCRCTable(){
              var c;
              var crcTable = [];
              for(var n =0; n < 256; n++){
                      c = n;
                      for(var k =0; k < 8; k++){
                              c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
                      }
                      crcTable[n] = c;
              }
              return crcTable;
      }") ] 
      Set Variable [ $r ; Value: MBS( "JS.AddFunction"; $$js; "crc32"; "function crc32(str) {
              var crcTable = crcTable || (crcTable = makeCRCTable());
              var crc = 0 ^ (-1);
       
              for (var i = 0; i < str.length; i++ ) {
                      crc = (crc >>> 😎 ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF];
              }
       
              return (crc ^ (-1)) >>> 0;
      }") ] 
      End If
       
      Next we have a script to process data and use JS.CallFunction to run our function. This allows us to pass the argument as JSON data and avoid building JavaScript on the fly where wrong escaping could cause a JavaScript injection by an user:
       
      If [ Length($$js) > 0 ] 
      Set Variable [ $p ; Value: MBS( "JSON.CreateString"; test::Input) ] 
      Set Field [ test::Output ; MBS( "JS.CallFunction"; $$js; "crc32"; $p ) ] 
      End If
       
      When the solution closes you can cleanup the JavaScript environment:
       
      If [ Length($$js) > 0 ] 
      Set Variable [ $r ; Value: MBS( "JS.Free"; $$js ) ] 
      Set Variable [ $$js ; Value: "" ] 
      End If
       
      If you have questions, please do not hesitate to contact us.
       
      from CRC function in FileMaker using JavaScript
    • By Richard Carlton
      We have a new fix for Google Maps in FMSP & the FMI Contacts Starter Solution
      Vid 1 - Getting your API Key:

      Vid 2 - FMI Contacts Starter Solution Fix

      Vid 3 - FMSP Fix

      Get up to speed with the FileMaker Video Training Course!
      FileMaker is a cross-platform relational database application from FileMaker Inc. https://en.wikipedia.org/wiki/FileMaker
      Top Rated Course by FileMaker Expert, Richard Carlton.
      http://learningfilemaker.com/fmpro17.php
      Customer relationship management, processes implemented to manage a company's interactions with customers and prospects
      https://en.wikipedia.org/wiki/CRM
      Experience Richard's dynamic and exciting teaching format, while learning both basic, intermediate, and advanced FileMaker development skills. With 26 years of FileMaker experience and a long time speaker at FileMaker's Developer Conference, Richard will teach you all the ins and outs of building FileMaker Solutions.
      The course is 50 hours of video content!
      Richard has been involved with the FileMaker platform since 1990 and has grown RCC into one of the largest top tier FileMaker consultancies worldwide.
      Richard works closely with RCC's staff: a team of 28 FileMaker developers and supporting web designers.
      He has offices in California, Nevada, and Texas.
      Richard has been a frequent speaker at the FileMaker Developers Conference on a variety of topics involving FileMaker for Startups and Entrepreneurs, and client-server integration.
      Richard is the Product Manager for FM Starting Point, the popular and most downloaded free FileMaker CRM Starter Solution.
      Looking for FM Starting Point free software download: http://www.fmstartingpoint.com
      Richard won 2015 Excellence Award from FileMaker Inc (Apple Inc) for outstanding video and product creation, leading to business development.
      RCC, Filemaker Videos, and LearningFileMaker.com are headquartered in Santa Clara, CA.
      http://www.rcconsulting.com/
      Contact us at support@rcconsulting.com
      FileMaker Pro is simply a powerful software used to create custom apps that work seamlessly across iPad, iPhone, Windows, Mac, and the web
      Transform your business with the FileMaker Platform
      https://sites.google.com/site/filemakerprotrainingd2n/home/filemaker-training
      Free FileMaker Training Videos Channel https://www.youtube.com/user/FileMakerVideos
      FileMaker Training -FileMaker Video Training Course-FileMaker News-FileMaker Experts
      https://www.youtube.com/watch?v=RO3Do8QIQOE
      https://www.youtube.com/watch?v=RO3Do8QIQOE&index=2&list=PLjTvUZtwtgBTWVT38kPvgjCfkZmMmvCOk&t=25s
      FileMaker What's New-Top Ten Things To Know About FileMaker -FileMaker News
      https://youtu.be/6ZcnQEOF9XE
      https://www.youtube.com/watch?v=6ZcnQEOF9XE&index=1&list=PLjTvUZtwtgBTWVT38kPvgjCfkZmMmvCOk&t=25s
      Sharing a FileMaker Solution-The Basics-Sharing FileMaker Database-FileMaker Experts
      https://youtu.be/a5o5Mt8DnFI
      https://www.youtube.com/watch?v=a5o5Mt8DnFI&index=9&list=PLjTvUZtwtgBQukMafXx60CF5rcXwNmGWl&t=0s
      A database management system (DBMS) is a computer software application that interacts with the user, other applications, and the database itself to capture and analyze data
      Official site SDK, Developer's Guide, Reference, and Android Market for the open source project
      http://learningfilemaker.com/FIAS.html
      Video introduction to iOS App Training https://www.youtube.com/watch?v=cVxQe_yAshw
      Free FileMaker videos check out ...http://www.filemakervideos.com
      Download the FileMaker Pro & FileMaker GO for mobile devices training videos at http://www.learningfilemaker.com
      Download FileMaker Go video training at http://learningfilemaker.com/FMGO-17/index.php
      Download FileMaker Full Video Training Bundle at http://learningfilemaker.com/subscription.php
      Learn how to use FileMaker to create an app with the FileMaker Training Series
      Comment, Like & Share All of Our Videos.
      Feel Free to Embed any of Our Videos on Your Blog or Website.
      Follow Us on Your Favorite Social Media
      Facebook
      Twitter
      Google+
      #FileMakerGoogleMaps
      #FileMakerAPI
      #FileMakerGoogleMapsAPI
      #FileMakerFreeVideoTraining
      #FileMakerTrainingVideos
      #FilemakerProTraining
      #FileMakerVideoTutorial
      #FileMakerProVideos
    • By Jhon Doe
      Hi everyone
      i'm new in filemaker, i'm using filemaker 17 and currently i'm involve in a proyect but i have a problem that i can't resolve, maybe someone of you have had the same problem.  
      I'm saving images in base64 format in a database to show them in a layout with web viewer,that doesn't has any problem, the problem is that i'm using a portal and i didn't know that portals don't support web viewer. I have to display those images but i can't remove the portal since i didn't do that layout and it has scripts using it along with the portal, is there a way to show images saved in base64 without use web viewer? (I've already tried to use container field but it only show a "?" image 😓 )
       
      My English is not the best but I tried my best ,Thanks for your help
       
    • By kigmaker
      Hello,
      I would like to use UUIDdecimal CF for the taskID rather than an auto-enter Serial Number. However I get Integer Notation like this:
      2.25640703445567e+37, rather than a number like this:
      22564070344556677882256407034455667788.
      I have toyed with other implementations of FullCalendar and have gotten it to work, but the related libraries were different versions and I can't recall how I solved the same problem then.
      How can I solve this?
      Example
      {
      "allDay" : false,
      "color" : "#FF0000",
      "end" : "2018-05-30T23:00:00**TIMEZONE**",
      "id" : 9,
      "start" : "2018-05-30T21:00:00**TIMEZONE**",
      "title" : "New Task"
      },
      {
      "allDay" : false,
      "color" : "#E69138",
      "end" : "2018-06-01T23:30:00**TIMEZONE**",
      "id" : 2.25640703445567e+37,
      "start" : "2018-06-01T22:30:00**TIMEZONE**",
      "title" : "Old Task"
      }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.