How to get the clicked URL from the BrowserField? - blackberry

My application has 2 screens. First screen contains a BrowserField instance, which displays a HTML file with lots of link.
When the user clicks on a link displayed on the BrowserField, the second screen should come. But now the new page is opening on the BrowserField.
How to get the clicked URL from the BrowserField?
How to display the new page on the second screen?

Read the documentation for the class BrowserField.
Check the method void setDebugger(BrowserFieldDebuggerdebugger).
Implement the method public voidpageRequested(String url).
BrowserFieldDebugger:
This abstract class allows a developer to debug web content running
within a BrowserField API application.
pageRequested:
This method is invoked for each new page that is requested
Parameters:
url - the URL of the newly requested page

Related

iphone "add to home screen" ignores querystring parameters

I have a mobile-friendly web application which I want users to be able to access from a link sent in an email or text. The link will include a querystring parameter specific to that user, which controls what the web site displays. This link might look like this:
https://corpsite/myapplication/?show=578
When the user goes to this URL using safari, the site grabs some information which is correct for the "show=578" parameter and all is good. (Security is not a factor here.) But after the application is installed to the home screen with the "Add to Home Screen" function of the iPhone 8 I am testing with, the URL which opens upon clicking the home screen icon is:
https://corpsite/myapplication/
The querystring information is not preserved! (I ultimately wrote some debugging code that tells me the full URL when the application loads. When I click on the link from an email and go there in Safari, the reported URL includes the querystring. But when I then save that page to the home screen and later click on the home screen icon, the reported URL does not include any querystring information.)
I have added this to the index.html page of the (Angular 5) application, which I thought would be all I would need to do (aside from some icon-related tags):
<meta name="apple-mobile-web-app-capable" content="yes">
How can I make this work from the home screen icon?
I found the source of my problem here:
PWA loses its params and query params after being added to the home screen.
It turns out that I was setting the start_url in my manifest.json file, and that was overriding the value in the browser. I just removed that setting from the manifest.json file, and the phone then used the URL from the browser when saving to the home screen.

Show flash message after user open specific page

I need create flash notification after user open specific page.
For example: we have page "A" in website menu. User click to link and open page "A". And after page "A" loading - showing
flash[:note] = page_a.note_message
And every time when user open page "A" - again showing this notification
By default, adding values to the flash will make them available to the next request, but if you need to access those values in the same request you can use flash.now in the controller.
You can read more about it in the Guides

Invoking Safari on iOS without opening a new website

The situation is like this:
User opens app from a website using a custom urlscheme
User does stuff in the app
User clicks button in the app to return to the website in Safari.
I have tried opening a new tab containing a javascript:window.close() but this does not work on iOS 6.1.
So my question is: Is there a way to open Safari to view the website the user left from? Either with a working new tab that closes itself or a different route?
When you open the app with your custom url scheme, pass the actual page url as an argument.
mycustomUrlScheme://mydomain.com?objectid=1234&callback_url=encoded_url
In your app, handle the url for the content info and keep the page url to open it afterwards. It will make safari open a new tab. But that should be a good start.
As far as i understand you can do it.
user opens mobile safari for example http://www.example.com
user clicks a link that is appscheme://open and the application become active
user taps a button to open safari for example http://www.example.com?q=test
for the third step you can use [[UIApplication sharedApplication]openURL:url]

how to open default blackberry browser when click on loaded page through browserfield

how to open default blackberry browser when click on browserfield.
i am trying load a html page on browserfield when i click on opened browser page that time i want to open blackberry default browser.
BrowserField browser = new BrowserField();
MyBrowserFieldListener listener = new MyBrowserFieldListener();
browser.addListener(listener);
MainScreen screen = new MainScreen();
screen.add(browser);
pushScreen(screen);
browser.requestContent(url);
i use this code it works but it also load in browserfield i dont want to load on browserfied
It is always easier to answer questions when they have some information on what you are trying to accomplish. Like jprofitt I'm confused about what you want to happen. However, it is a bit of a kluge but you could:
in MyBrowserFieldListener detect that a link has been clicked when documentLoaded is called;
get the URL from the BrowserField with getDocumentUrl();
Launch the default browser with that URL;
If you want the BrowserField to remain on the original page call requestContent() or back().

BlackBerry BrowserField Issue

My BlackBerry app uses BrowserField to display web pages. I have implemented the eventOccurred() method for the RenderingApplication. The first page loads fine. EVENT_BROWSER_CONTENT_CHANGED is fired after the URL is requested (EVENT_URL_REQUESTED) and the first page loads fine.
A button on the first page redirects to a different page. This works on a regular browser. On the simulator, the same page gets loaded again when the button is clicked. When I debug, I see that the EVENT_URL_REQUESTED is getting fired but the event.getURL() is same as the first page URL. I don't understand whats going on and if I am missing anything very obvious. Can anyone help please?

Resources