AnsweredAssumed Answered

Web Viewer javascript step fails locally:

Question asked by justinc on Dec 1, 2016
Latest reply on Dec 2, 2016 by justinc

I ran into an odd issue with a bit of Javascript that is running in a web viewer in our solution.  We have had this WV+Javascript working for quite a while now, in files that are hosted on FMS.  The user goes to a layout, clicks a button to open a pop-out window that contains the web viewer.  This web viewer has some buttons and reads keystrokes, and calls back to the open FMP file to affect changes there.  This has been working fine.


But then we wanted to make a trial/demo version of this file, and have the user run it locally or offline.  In testing this offline file it was noticed that the pop-out window web viewer stopped calling back to the open file.  OK, that was because it was still using an IP address for the 'host' instead of the '$' reference in the FMP URL.  But even with that fixed, there was one step that was failing still.


To affect these 'callback' events from the WV+javascript to the FM file, the javascript was using this code:'fmp://' + fmdbHost + '/' + fmdbFilename + '?script=keyPressed&param=' + e.keyCode, 'form_b');


My solution/workaround, was to instead use this code:


window.location.href = ( 'fmp://' + fmdbHost + '/' + fmdbFilename + '?script=keyPressed&param=' + e.keyCode );  



This workaround appears to work out just fine.  But I'm just curious to know why the original step was failing in the first place.  This was working if the file was why would that fail if the file is being run locally?  Does it do some kind of URL verification, and not like the "fmp://" or perhaps the "$" part?