Jump to content
Server Maintenance This Week. ×

WebViewer InnerHTML


andries

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

Recommended Posts

Hi

I am trying to get the innerHTML of my webviewer, as the data is set by JavaScript.

Is there any possibility to achieve this?

I was thinking of using the following technique:

Set the URL to : javascript:a=document.body.innerHTML; ... and then grab it with the GetLayoutObjectAttribute function.

but I have the feeling this is not going to work

Link to comment
Share on other sites

Scraping the Web Viewer for information will only provide the source HTML (or other code) BEFORE the rendering/processing engine has interpreted it. Thus you will get access to raw HTML with all the tags, CSS formatting, and JavaScript commands.

You will not get formatted text (bold, italics), page layout, graphics, or the results of JavaScript commands. The last one is the real bummer for me. I really would like to be able to farm out certain complex processing tasks to the JavaScript engine and obtain the calculated results for me to assign back to a FileMaker field, but alas that is not possible yet without a plug-in.

Link to comment
Share on other sites

thanks for the reply... this is indeed a bummer...

I was inspired by the following post: http://filemakerforums.com/forum/showtopic.php?tid/210471/fromactivity/forum/

but there it fails loading my webviewer...

Edited by Guest
Link to comment
Share on other sites

Link to comment
Share on other sites

Actually I found a way to grab some content created by JavaScript in FileMaker.

The trick is to create a dynamic HTML link "" with javascript. This HTML link refers to the same page, but adds POST parameters to it. For example "http://localhost/~user/test.html?Script=Test&ScriptParam=testscriptParam".

After working with this for a little while it seems that this method requires the page to be fetched from an actual web server. Specifying the URL for the Web Viewer with the method of "data:text/html,the page source code" doesn't do what is required to get calculated data back encoded in the URL.

Link to comment
Share on other sites

You can have the JavaScript automatically "click the link" for you when the page loads on its own using the JavaScript line

window.location = "http://localhost/~user/test.html?Script=Test&ScriptParam=testscriptParam";

instead of creating a link anchor.

Then immediately after the web viewer finishes displaying the original JavaScript, the GetLayoutObjectAttribute ( "wv" ; "source" ) command will give you the URL with the parameters encoded.

If you add an OnRecordLoad trigger to the Layout and put in a Pause Script step before finding the value of GetLayoutObjectAttribute ( "wv" ; "source" ), the calculated JavaScript data should be available without user intervention.

Link to comment
Share on other sites

- the post thing... I actually know this... dumb dumb dumb

- about the javascript action: will try this

- indeed it only works if you host it on a server ( but as I work on a Mac, I always put my HTML pages on my server, and send the params with data from FM via the GET method to my HTML page)

- Using the unstored calc to trigger a script in FileMaker directly from the webviewer works, but only after you force the unstored calc to refresh...

Edited by Guest
Link to comment
Share on other sites

Actually I am also really wondering how difficult it can be for FileMaker to introduce this feature to get the innerHTML, they are already rendering the page, so they know what the innerHTML is.

Second question I have. On a Mac I always assumed that it was Safari that was used for the webviewer (and IE on Windows machines). Is this correct? However I found out that for example with the ckeditor WYSIWYG editor this editor works perfectly in Safari, but if you load the page in the webviewer not all functionalities are working. So now I think that it is not entirely true that it is simply Safari is used but may-be some light version of it. Is this correct?

Link to comment
Share on other sites

Actually I am also really wondering how difficult it can be for FileMaker to introduce this feature to get the innerHTML, they are already rendering the page, so they know what the innerHTML is.

There's the rub. FileMaker is actually not doing the rendering. FileMaker is providing the space on the Window and farming it out to a third party library to do the rendering. FileMaker doesn't know what's in the web viewer directly. It only knows the bits of meta information that the third-party library is offering back (url & source) to go along with what it is drawing in the window. The window could be text, graphics, sound.

Second question I have. On a Mac I always assumed that it was Safari that was used for the webviewer (and IE on Windows machines). Is this correct?

I would expect that it is the WebKit framework (library) that is doing the rendering on the Mac. This is the same framework that Safari is built on, but the WebKit used by FileMaker may be out of sync with the WebKit built-into Safari.

It is possible that WebKit is also used on the Windows version of FileMaker since that code is cross-platform, but it is also possible that an IE library is being used for the rendering.

Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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