Managing _blank links - c#

I'm using xulrunner to show some content from a website, it works perfectly for the most, but we have included a facebook like box with stream (div+javascript), and clicking on any link in it does nothing.
We would like to open it in a new window of the default browser, it's possible?
the code for the xulrunner is pretty simple
private void Form_browser_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
geckoBrowser.Navigate(Properties.Settings.Default.redirect);
}

Related

UWP/C# LaunchUriAsync Size issues

Sorry for the mess of a title.
Ive got the following C# script handling an Async Button press:
private async void CalcButton_ClickAsync(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("calculator:"));
}
Issue i have is that the calculator is loading up the exact same size as the main program window. I was wondering if there is a way to over-ride the sizing of the launched windows, i want the calculator to open up as small as possible really.
Come to think of it, i think every popup windows is doing this (save/open file dialogues) any thoughts/suggestions would be amazing
You can request the desired remaining view. Keep in mind that it is specifying the remaining view of the app that is launching the calculator... not the size of the calculator app.
link here
private async void LaunchCalculator(object sender, RoutedEventArgs e)
{
var options = new Windows.System.LauncherOptions();
options.DesiredRemainingView = Windows.UI.ViewManagement.ViewSizePreference.UseMore;
await Windows.System.Launcher.LaunchUriAsync(new Uri("calculator:"), options);
}

Windows Phone 8.1 open link in other app

I have a program which can show some links (music/video/ etc....).
I want when Clicked on download button, my app send that link to UC Downloader for download. I can open link with Internet Explorer but I want open in UC Downloader.
You can launch an app from your code if you know. From the msdn :
By using the association launching API, your app can automatically launch another app by launching a custom URI. To do this, use the Launcher.LaunchUriAsync(Uri) method from the Launcher object of the Windows.System namespace. For example, the following code launches a fictitious Contoso app to display new products.
Example :
private async void LaunchContosoNewProductsButton_Click(object sender, RoutedEventArgs rea)
{
// Launch URI.
Windows.System.Launcher.LaunchUriAsync(new System.Uri("contoso:NewProducts"));
}
You can find a tutorial here.
Here's how.
Windows.System.Launcher.LaunchUriAsync(new Uri("uc-url:http://www.microsoft.com"));
private async void Button_Click(object sender, RoutedEventArgs e)
{
string uriToLaunch = #"http://www.bing.com";
var uri = new Uri(uriToLaunch);
var success = await Windows.System.Launcher.LaunchUriAsync(uri);
}
In windows phone 8.1

C# Winforms WebBrowser open links in default browser

I know this has been discussed several times around here but the default behaviour for opening links
clicked in a WebBrowser control does not work for my application.
So while this works as in it opens a link clicked in IE:
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
System.Diagnostics.Process.Start(e.Url.ToString());
e.Cancel = true;
}
I am using a dropdown list to update the html file that the webBrowser is displaying like so:
private void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
webBrowser1.Url = myURI;
}
Now the problem I'm having is that with the _Navigating method above, the webBrowser does not load any subsequent changes to the URL (thanks to the e.cancel I guess) so it only displays the first html file it loads.
If I remove the _Navigating method it updates fine but then the links open up in the same webBrowser control which is what I do not want.
How can I get it to work both ways?
I hope this can help you.
If you want to open a link in a browser, you can add this simple code:
Process.Start("http://google.com");
Remember, there is a lot of information about it. Here in stack Overflow you can take a look in this post: How to open in default browser in C#
If you want to open your link in another browser, you can use this code:
System.Diagnostics.Process.Start("firefox.exe", "http://www.google.com");
Don't forget to visit this post called: How do I open alternative webbrowser (Mozilla or Firefox) and show the specific url?
And Finally, I could recommend you this stack overtflow post called: .NET C#: WebBrowser control Navigate() does not load targeted URL
I hope this information can help you a little bit.
This is an old post but I believe I may understand what the original poster wanted to do. They wanted a page to load in the webbrowser control if the user selected it from the dropdown list but any links in the loaded page should open in the user's web browser. If this is indeed the case, the original poster need a flag on the form to determine the behavior.
The original poster simply needed a flag such as linksOpenInSystemBrowser shown below.
using System;
using System.Windows.Forms;
namespace Browser_Test
{
public partial class myForm : Form
{
private bool linksOpenInSystemBrowser = false;
public myForm()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
linksOpenInSystemBrowser = false;
webBrowser1.Navigate(comboBox1.SelectedItem.ToString());
}
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
if(!linksOpenInSystemBrowser)
{
linksOpenInSystemBrowser = true;
return;
}
System.Diagnostics.Process.Start(e.Url.ToString());
e.Cancel = true;
}
}
}

Facebook Like button doesn't work in GeckoFX browser

I wanted to implement the Facebook Like button into my C# application using the Web Browser control but i encountred a problem with Internet Explorer (After clicking on like button, the facebook login popup appears) but iexplore block and ask me whether to recover the page.
Therfore, i downloaded geckoFx to embed Mozilla on my application instead of the in built Web Browser control ! But now when i click on the Like button on the Gecko browser, i get a blank page. And when i right click the page to view the source i don't see anything (blank page)
Maybe the problem is either the GeckoFX browser doesn't support Popups or doesn't support Javascript
How to implement Facebook Like Button inside GeckoFX browser in C# Windows Forms ?
I'm using XUL runner 1.9.1.19
New Windows and tabs are not handled automatically. You need to create events for those:
private void webBrowser_CreateWindow(object sender, GeckoCreateWindowEventArgs e) {
e.WebBrowser = NewWindow();
}
private void webBrowser_CreateTab(object sender, GeckoCreateTabEventArgs e) {
e.WebBrowser = NewWindow();
}
private GeckoWebBrowser NewWindow() {
BrowserForm frm = new BrowserForm();
frm.Show();
return frm.WebBrowser;
}
Here BrowserForm must contain a public property that points to the GeckoWebBrowser control.

Pass data between web forms inside ASP.NET

In Winforms I Can do following
protected void SomeButonClick(object sender, EventArgs e)
{
ChildForm cf = new ChildForm();
cf.Grid = ParentForm.Grid
cf.ShowDialog();
//and so on
}
How I can accomplish something similar in ASP.NET WebForms.
There are a number of ways to approach this in ASP.NET. Your use of "ShowDialog" suggests to me that you will get what you want out of using jquery to launch a modal popup. There are several canned tools for this, like jquery popup.

Categories