CocoonJS webview: Going back a page - cocoonjs

I'm just trying out a simple app in the CocoonJS launcher which contains some links that open some external page.
This works fine, but the problem is that I can't identify a way to go back a page (i.e. history back). The launcher app just displays the page in fullscreen, no user controls visible at all. This is troublesome, because when my users tap on an ad, I want them to be able to go back to the game.
Am I missing something or is this simply not supported?

I do not know of any way to display a navigation bar or something similar.
Nevertheless, you can open your external urls via Cocoon.App.openURL(url); which will enable the user to open it via a normal browser where you can navigate back.
Regards.

I agree with the solution proposed by Scdev. Also, interstitials or fullscreen ads usually have a dismiss button themselves. I might be misunderstanding something.
Regards,
Iker.

Related

How do I get my button to redirect to a web page within the app?

So far, I have it so that when a user presses a button, a browser opens and redirects the user to my desired url. However, I want this to happen within the app instead of a web tab. How can I do this?
Use the BrowserComponent, just add it to the center of a border layout form and set the URL for that component. Check out the list of main components in Codename One within the developer guide.
Define a xml layout containing a widget called webview. Then in your activity you implement a listener to your button which invokes that xml with the desired page to load inside your webview. Google to find some code and return here with your code problems, if you find some. If this will be the case, open new questions provinding detailed info about your matters then we can help more. Best.
EDIT: Excuse me, just now, re-reading your question I think I really understand it, and the solution is very simple, just a line of code (to instruct your app to open a webpage inside your webview, and not the regular browser, outside your app). Try this:
wv = (WebView) findViewById(R.id.myWebView);
wv.setWebViewClient(new WebViewClient()); // needed to open url inside our webview, otherwise it will open at the default browser
wv.loadUrl(url);

How can I remove Unwanted ads on my drupal

I see some ads on my drupal website. No idea where they came from but I want to get rid of them. Any help appreciated
This one comes up from the bottom of the screen from time to time.
You can minimize it but it doesnt go away unless I close my webpage, and open again
It was related to Softonic Toolbar not something with Drupal.
I removed all the toolbars or that kind of unwanted programs which I installed(without conscience) then cleaned with Malwarebytes and CCleaner.
Now everythings fine
I had the same problem. I solved the problem by deactivating the ad option. To do this, simply click on the "ad option" at the bottom of the ad. You will get a page that mentions different things about the ad. Click on "deactivate" link. It will take to another page where you can deactivate the advertisement. It won't come back.

How to open application from a webbrowser windows phone

I am developing a windows phone application.
In a page I placed a button and on this button click I open the webbrowser and redirects to our website pages for some processes. There are many webpages. In the last webpage we added a button "Close". In the close button click I want to close the webbrowser and open the application back with the last state before opening the webbrowser. How can I do this ?
Thanks.
I will refer to the button in the app as "app button" and the button in the web page as "close button".
Add a WebBrowser control called webBrowser1 to the Windows Phone app. Make it cover the entire screen, and set it's Visibility property to Collapsed.
On the app button's click event, use
webBrowser1.Visibility = System.Windows.Visibility.Visible;
webBrowser1.Navigate(new Uri("http://yourwebsite.com/page");
to show the web browser and navigate it to the first page on your website.
Make the close button on the last page of your site navigate to a new page on your site, called "close.html" or whatever you want. In javascript, this would look like
<Button onclick="window.location.href='http://yourwebsite.com/close.html';">
Back in the app: On webBrowser1's Navigating event use,
if (e.Uri.ToString().Contains("close.html"))
{
webBrowser1.Visibility = System.Windows.Visibility.Collapsed;
}
When the you click the button on the last page of your site, it navigates to "close.html". When this happens, the Web Browser's Navigating event fires. Since this event fires every time you change pages, you need to check to see if the new url contains "close.html", the page your close button is navigating to. If it does, the Web Browser will be hidden and you will see your app again.
.
(In VB, the code would be )
webBrowser1.Visibility = System.Windows.Visibility.Visible
webBrowser1.Navigate(New Uri("http://yourwebsite.com/page")
And
If e.Uri.ToString.Contains("close.html")
webBrowser1.Visibility = System.Windows.Visibility.Collapsed
End If
Edit: I was thinking in generic terms when i wrote the answer and did not remember that you are asking specifically about the webbrowser (hence, using a webbrowsertask launcher). Thank you #Claus for point out the OAuth situation. So, i am amending my answer to explain that it is possible and also mention an issue with using the launcher as there is no way guarantee to return back to a given point in your launcher app (as it is with choosers due to the availability of callbacks).
It is not possible to achieve this in general terms. That is, there is an application A which opens another application B and from application B you would like to close-it-and-open-A. There are many reasons why i think it is not possible:
- How does one get the address/reference to the application A. No API for that at the moment.
- There is no content-handler/plugin where a 3rd party can register an app with the web-browser.
- Most importantly, security, security, security. This would open doors for attacks from the web.
However, for your requirement of application B being a web-browser, it is possible to use a task launcher WebBrowserTask. As #claus suggests, you could have Window.close() javascript in your last page to close the browser and hence reveal the app underneath it (hopefully, A). The problem here is that if, the user opens an app (let's call it C) after the browser has launched (and before the browser is closed), and the user does not close C, then when the browser gets closed, the user will be returned to C and not to the launcher App! This is not what you want based on your requirement.
So, if you would like to achieve the kind of effect you are describing in your question, it is best that you embed the Web-browser in your application (as a full-screen app) and from that vantage point you can interact between the web-browser (control) and the (host) app via Javascript.
Hopefully, this helps.

Windows Phone show ConnectionSettingsTask and back

I am working on a windows phone app right now.
In the app, I am handling an exception in page 1, that when there is no wifi connection, it will pop a XNA messagebox, user can choose to open the WIFI settings page. I have the following code:
ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
connectionSettingsTask.Show();
But the problem with this is, when user hit back key in the wifi settings page, they will be navigate back to page 1, which has a loading problem and can not display the proper content. In this case, I would like user to directly go to another page, call it page 2.
Is that possible? Thank you
++++++++++++++Update
Is there are way to customize the back key functionality when showing the XNA messagebox?
I don't know about XNA coding much, but I do know that if you return from wifi connection page to your app, the OnNavigatedTo function is invoked. Try setting out your flow of code according to the application flow. If there is some code you have executed at the constructor, shift it to OnNavigatedTo and vice-verse, which may solve your problem. Also if you want to shift to another page, do it in the same function (OnNavigatedTo) itself. Hope it helps.
Maybe you can change the navigation behavior: http://blogs.msdn.com/b/ptorr/archive/2010/08/28/redirecting-an-initial-navigation.aspx
However it is recommended to merge the two pages together (hide loading bar and show main page) as you will have less problems...
why not handle this code in the IsNetworkAvailable check? that way you'l avoid the exception altogether

Silverlight Notification API in-browser

I'd like to use the Notification API to create toast notifications for a Silverlight app designed to run both in and out of the browser, but the NotificationWindow class is only available OOB.
Does there exist anything that can replicate the behaviour inside the app? My idea is to have a container in the bottom right of the screen overlaying all other content. Then, create a wrapper which detects OOB-mode, passing params to the Notification API if possible, or populating and showing my own container if not. Is there anything that does this available?
It seems strange that MS chose not to implement something like this, as has been pointed out before.
Displaying a notification in browser is simple. You just need to use a popup and make it appear in the right place. See the following post as an example.
Now the difference with that approach is that the notification will show inside the browser. In OOB it shows outside the window and it's visible even if the windows is minimized. Due to security reasons it's not possible to directly do this.
Out of interest, Chrome Applications like Tweetdeck and Gmail, are able to display notifications outside of the browser. I think this might be a possiblity, but not exactly a Silverlight and cross browser solution.

Resources