JXBrowser - Any way to right click + inspect or dev tools? - jxbrowser

I am asking because if you are coding and testing against JX generated browser, and say you want to inspect elements to add to the code, or inspect a button to see a link, you shouldn't have to open up another browser, follow the same clicks to do that.
Is there a way to enable a full browser window? Including all functionalities of a normal browser? Address field and so on??
Browser browser = jx.browser;
BrowserView browserView = new BrowserView(browser);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.add(browserView, BorderLayout.CENTER);
frame.setSize(1024, 768);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
browser.loadUrl("http://www.google.com");

If you would like to inspect HTML elements on the loaded web page anytime, then I recommend that you run your application with the --remote-debugging-port Chromium switcher every time. You can read more about this switcher at https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013082-remote-debugging-port
JxBrowser doesn't provide "full" browser window with tabs, address bar, etc. JxBrowser is just a component/library, not an entire desktop application. Using this library you can build your entire desktop application with tabs, address bar, etc.

Related

How to get the file content in the OnDrageEnter event from IDragData?

In an winforms implementation of CefSharp I have implemented the IDragHandler.
In the OnDragEnter event I would like to get the file content.
Currently I am using
Dim st As IO.Stream = Nothing
Dim i As Integer = dragData.GetFileContents(st)
There is no data written to the stream.
Can you get the file content from a file being dragged from outside (eg desktop) onto the browser?
I assume this is an upstream issue, however, if I drag a selected Outlook item the dragData has no files, or filename but the IsFragment is true and the FragmentText includes what looks like some general info about the email like subject. This is an upstream issue right?
Adding my comment to the answer please see Issue 322605: Drag and Drop support for E-Mails from Microsoft Outlook.
To be complete I wanted to add how I solved this until Chromium catches up. I am hosting my CEFSharp winforms instance in a WPF window. When the CefSharp OnDragEnter event fires I open an almost transparent popup directly under the mouse pointer. This popup has the drag events for WPF enabled and once they fire and give me the dragged contents i close the popup. It is a little but tricky as the OnDragEnter event from CefSharp fires once the popup is gone but otherwise I can find out what is being dragged.

Closing chrome custom tab

In my use case, I have a page that deep links back to my app. When I open this page in Chrome custom tab, I am able to get back to my app by clicking the deep link but the issue is when I click on the device back button, the chrome tab is still visible.
Is there any way I can close the chrome custom tab when the user is back to my app/activity.
Setting the below flag while opening chrome custom tab seems to resolve the issue for me
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_HISTORY
As #Jaspinder Kaur mentioned: you need to add this on your flag:
mCustomTabsIntent = new CustomTabsIntent.Builder().build();
mCustomTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HI‌​STORY)
AND:
If you set your app to be singleInstance or singleTop, then when you go back to it using an intent, the framework will finish Custom tab activity as well.

window.open in web application for iPad running in fullscreen replaces the existing window

I am writing a simple (ASP.NET) web application for the iPad. It is written and works well however one feature is it serving up PDF files (among others). To do this I used window.open to open the file.
When this is done in Safari, it works perfectly. You click the button, the file opens in a new tab; you can then close the tab to return to the previous web page.
However now running the application in fullscreen mode - i.e. with the appropriate "meta names" set and from a shortcut on the home screen - when you click the button to load the file, it loads fullscreen with no means to get back to the last page.
Because it is a file, not a webpage, I can't put a "Back" button on, and when you press the iPad button it simply closes the whole thing.
I know this has been asked before and I have read a number of similar questions - the closest of which was this:
https://stackoverflow.com/questions/9168236/web-app-hyperlinks
If at all possible, it would be far preferable (thanks to the control library I am using) that the button click is done with javascript - it is not easy to set the link href.
The upshot is I really I just want to create a new window from within a fullscreen iPad web application, or allow the "back" navigation somehow...
Is this possible?
Thanks!
Create an iframe on your page rather than using an window.open and set that as the target.
That way your pdf would open within your existing window.
Use some client side javascript like jQuery to style it like a dialog window.

navigateToURL ... set modal property

When a user clicks a button, I need a separate browser window to popup. How can I set the modal property of the application? (ie, when a popup window opens, the main application is disabled until that popup is closed ... I need to use a browser window rather than a popup window, but can't figure out how to disable the main application)
PopUpManager.createPopUp (this, navigateToURL( url, "http://www.google.com" ) , true );
thanks!
[[Updated Answer]]
Ok, my modal dialog looks like so:
cg = mx.managers.PopUpManager.createPopUp(this, ChoiceGrid, true) as ChoiceGrid;
PopUpManager.centerPopUp(cg);
But, what I would do instead of what you're asking, is embed an IFrame in the modal popup. This is exactly what we're doing in our app to collect CC data (well, not the popup part, just the IFrame bit. http://code.google.com/p/flex-iframe/
This way, you have the standard modal dialog you're looking for, AND an internally managed 'view' out to your checkout server. Something like this:
<code:IFrame id="iFrameWithJSfunctions"
src="{checkoutURL}" />
The flex-iframe is pretty easy to work with, for the most part. You shouldn't have many problems with it.
[[Original Answer]]
I'm not sure you need a PopUp to do this.
Why don't you simply do:
navigateToURL(urlRequest,"_blank");
instead?
You should think of a Flex App as a self contained entity. The PopUpManager is designed to create Windows (Panels / any UIComponent) that reside over another component inside the SWF. It does not create items that pop up out of the SWF or in new browser windows.
navigateToURL could be used to create a HTML pop-up from your Flex application. However, there is very little--if any--communication between the SWF and the browser pop up. And there is no way to make a modal pop-up.
You might investigate performing an ExternalInterface call and creating your new pop up in JavaScript. Here is an article about creating modal windows in JavaScript. Before going too far down that road, I would think carefully about your requirements. How would feel if one browser window popped open another browser window and prevented you from doing any browsing until you addressed the issues in that window. Or to put it another way, how would you feel if Microsoft Word opened a word document and wouldn't let you edit any other document until you shut down the first one? I'd be pretty upset.
Modal application dialogs are one thing. And the PopUpManager allows you to create those. I would consider Model application windows a bad UI decision.

Application.application.nativeWindow.activate() problem on Windows

I have an AIR application with a system tray icon. When clicked it shows and activates the app. This is working as expected when the app is hidden (docked), however if I select another application so my app is in the background clicking on the system tray icon does nothing.
Oddly I also have a contextual menu on the system tray icon, which has an option to restore, this calls the same event handler as ScreenMouseEvent.CLICK, yet works.
I expect it's something to do with the contextual menu changing the focus, perhaps it's a bug in how AIR works with the system tray, perhaps it's just something I'm missing. Would be good to know if that's the case.
Thanks in advance
Rob
//instead of just calling
activate();
//call
nativeApplication.activate()
//or even better
nativeApplication.activate(nativeWindow);
Update based on OP's input: if you have multiple windows open for the application, use:
nativeApplication.activate(nativeApplication.openedWindows[0]);
If you are not in the main WindowedApplication class, you can use the static property NativeApplication.nativeApplication to get a reference to the singleton object.
WindowedApplication.activate()
Activates the underlying NativeWindow (even if this application is not the active one).
NativeApplication.activate(window:NativeWindow = null)
Activates this application. If the operating system allows activation, then the specified window is activated and brought to the desktop foreground; that is, in front of the windows of other applications. (If the window parameter is null, then a visible window of this application is activated.)
livedocs is not clear on why this is happening. It says activate() activates the underlying native window - one would expect it to be brought to the front when it is activated, but that's not happening.

Resources