Send Message on Page Load

What would be the best way to send a message out in perspective when a page is first loaded? I have a docked view that I would like the label to change on depending on what page is loaded.

You can do that via an onStartup script on the page and specify your message there.

Where would I find the page startup script? Do you mean the view? If so that seems not to fire off when refresh on the browser is pressed, but interestingly it does fire off when I use the back and forth buttons on the browser. I think this will cause problems with what state the page is in vs what should be displayed on the docked view.

Right now on the view OnStartup script I have a message being sent that the docked view is listening for on the page scope. When I first go to the page this works fine, but if I navigate away and come back to the page via a menu link the OnStartup Script does not fire off.

This is the behavior I am witnessing:

  1. Visit page for first time OnStartup script fires off
  2. Subsequent page visits via a menu tree item does NOT fire off OnStartup script
  3. Refresh button on browser OnStartup script does NOT fire off
  4. Back button on browser OnStartup script does NOT fire off
  5. Forward button on browser OnStartup script does fire off

I think I could live with all of these except #2. Why is the script not firing off when I visit the page again via a link?

1 Like

I’m having similar issues as @Jonathan in Maker Edition version 8.1.0. The onStartup script for my view simply sends a message without any payload and scope declared as ‘view’. There are a couple Dropdowns on the view are listening for the message at the page and view scope. I confirmed at least one of the message handlers is configured correctly since it is reliably triggered by another component on the view. Specifically, the message handlers are simply setting the props.value of the Dropdowns to ‘’.

Here are my results with my gateway running on a Raspberry Pi and my session running on Firefox on Ubuntu 18.04.

  1. The script DOES run (dropdowns are cleared) when first visiting the page (copy address, close tab, then paste and go to page address)
  2. The script DOES run when navigating to another page then back using a menu tree. This didn’t work for @Jonathan
  3. Refreshing using F5, ctrl+R or the GUI Reload button DOESN’T run the script
  4. Using the browser back button or alt+leftArrowKey then forward back to the page if the previous page is the browser start page DOESN’T run the script
  5. The same browser back then forward DOES run the script if the previous page is a different page in the session
  6. A button with the same code in its actionPerformed event as the view’s onStartup script DOES run the script

Any ideas on this? Seems like the onStartup isn’t all that useful if it doesn’t respect the various ways a page could be restarted in a browser.

1 Like

Wondering the same thing, where do I place a script I want triggered on a page refresh?

Any updates on this? Looking for my view on startup scripts to fire on browser refresh.

Also looking for an answer for this. Note that one work-around would be to use a webdev page.

1 Like

Any updates on this topic?