Web Browser Object

If the html page contains javascript that changes a tag value, for example a

and the javascript will add text to the tag is there a way for Panorama X to know the new value of the html in the WBO?

Panorama can run JavaScript in the browser object, and JavaScript has complete access to the DOM. There is currently no written documentation on how Panorama code can run JavaScript in the browser, but I did demonstrate it in the class. Learning how to access the DOM in JavaScript is a huge topic, one which I have definitely not mastered myself. There are scores of books, web pages, Lynda.com classes etc. on this topic.

I am not sure I understand. I have a variable to display the html in the Web Object, vHTML. When that variable is first shown in the Web Object, the html paragraph tag has no value. The vHTML variable has a text input field and a html paragraph tag with javascript that will change the the empty html paragraph tag . So, if I input my name into the field, the javascript will change the html paragraph tag to p>steve</p and the Panorama Web Object updates the the display html correctly. If I create a TDO with the formula xtagvalue(vHTML,“p”) it still shows the tag empty. Javascript is updating the DOM and the html paragraph tag but the variable vHTML has not reflected the javascript changes. Is there a way to do this? Here is the code. If you monitor the Web Objects variable it doesnt change.

Fileglobal vWebPage

vWebPage=|||<!DOCTYPE html>
<title>Javascript Input field changes anothr object</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
  $( function() {
    $( "input" ).keyup( function() {
      $( "p" ).text( $("input").val() );
    });
  });
</script>

<input placeholder="Enter your name">
<p></p>|||

showvariables vWebPage

No, I didn’t say that the variable would change. Your JavaScript is changing the DOM (at least I assume it is, I’ve never seen code like that and I have only minimal experience with jquery). The DOM is strictly internal to that WebKit instance, Panorama knows nothing about the DOM and does not normally communicate with the DOM.

WebKit has no clue that it was initialized with a Panorama variable. The formula in the Panorama Web Browser object is used to initialize the web browser (and to reset it, if the formula value changes), but beyond that there is no connection between the Panorama formula and WebKit. It’s just as if you had a copy of Safari running inside your form – Safari does it’s thing and doesn’t know or care anything about the fact that it is running inside a copy of Panorama.

However, using the objectaction statement you can send some JavaScript code to WebKit. WebKit will run the code and report back any results. So you could, for example, write JavaScript to print out the current HTML source contained in the WebKit instance. However, this requires knowledge of JavaScript and beyond that knowledge of how the DOM interfaces with JavaScript. There are entire books about that. I’ve been working my way thru a Lynda.com course on this, but so far I haven’t gotten very far because there is way too much else on my plate. So I can’t dash off the necessary JavaScript off the top of my head. As I mentioned, none of this is documented in the Panorama documentation, the only source for this is in the Web Browser Object session on the Vimeo On Demand classes. Steve, I’m pretty sure you have access to that course, so I would highly recommend that you review it to learn how to use the objectaction part of this. But you’ll also need to do separate study of the JavaScript side of this (which is not unique to Panorama, JavaScript and the DOM work exactly the same in Panorama as they do in any other web page, so any general learning material on this topics will be helpful).

Hi Jim,

Understood. I do have some understanding of javascript so I will take a look on Vimeo, I dont at the moment remember how to get to the videos though.

Steve, I know you were in the course live (thank you!) so you may have downloaded the raw videos at that time. If not, unfortunately those aren’t available any more.

If you have ever purchased the Vimeo course (Vimeo doesn’t tell us who has purchased, so I don’t know if you have or not), you can watch using the Panorama Video Training wizard (in the Help menu) or you can go right to the web page for this session: