Here are the properties of my Web Browser component. This is for a kiosk-style PC that is just used to access some .pdf's stored online. Menu bar is hidden, application starts full screen by default, that type of idea.
I want to add a button (or other component) to this screen that will force the web browser to initialize, a.k.a. go back to the starting URL. This is because I have removed the navigation buttons but still want a way for users to get back where they started in case they get lost. Possible? Note that I know exactly zero things about JxBrowser and Chromium switches, and it would be awesome to keep it that way.......
I found something that works... I used system.util.retarget()
and set the project name parameter to this project (self-referential). I put this in a client event script attached to a secret keystroke. So we can hit the keystroke and the project initializes. Pretty neat!
1 Like
Lighter weight than a full retarget: just close the window with the web browser and reopen it?
I like that idea. I just tested it out, and it is much faster. Problem is, when I reopen the window, the web browser has not initialized. It reloads back to the same screen I was looking at before closing the window. I can't find an obvious way around this so I will keep the retarget logic in place for now.
Might work if you set the cache policy of the window to 'Never'?
2 Likes
That worked! Very nice... thank you so much!
Even lighter weight, now that I've actually looked at the code... what if you changed the mode to 'html' and then back to 'url'? You might also need to reset the starting URL property in the meantime, though.
1 Like
Even better. I have a docked view containing a button ("CLICK TO RESET") which contains the following event script:
window = system.gui.getWindow('My Web Browser Window')
webView = window.rootContainer.getComponent('My Web Browser')
webView.mode = 1
def backToUrlMode():
webView.mode = 0
system.util.invokeLater(backToUrlMode)
This works pretty much instantly. Really appreciate the help!
2 Likes