Open a new browser Window from a webview, without user input - webview

I'm looking for a way to open a new browser window from a WebView, from a wp8.1 RT, silverlight or UWP app.
It should happen when the page loads, or after a few seconds, without any user input (I know it's possible if the user clicks on a 'target="_blank"' link)
Does anyone know if any way to do this exists?
I tried with window.open, jquery's .click() or .submit(), but nothing...
Neither the the javascript alert() works, it does work instead redirecting to a uri protocol with location.href and open an app, but unfortunately IE/Edge doesn't have an app protocol to launch it...
Any help would be much appreciated.

Since you put both Windows Phone 8 and Windows 10 in your tags, I can't be sure what to offer you here. SO I will tell you how to do it in 8.
JavaScript in a WebView can call external C# code by using ScriptNotify. You can read more about that in this question: Call Native C# from WinJS that's loaded in a WebView
Also, once you are in C# and you want to launch a browser, the answer is to use the LaunchUriAsync API. Read more about that here: https://msdn.microsoft.com/library/windows/apps/windows.system.launcher.launchuriasync.aspx
Best of luck!

Related

Is there a way to dismiss a native authentication dialog when using Playwright?

I'm using Playwright (Java) to drive a particular third-party Web site, the first page of which apparently containing two images which are password protected; this causes a sequence of basic-authentication dialogs to open when the page loads.
I'd like the script to dismiss these dialogs (cancel), rather than providing any credentials, and then continue working with the page. But as it stands now, the page.navigate() blocks and eventually times out, unless I cancel these dialogs manually with the mouse.
Note that this is the native browser dialog, not anything generated from js on the page.
Is this possible with Playwright?
Interestingly, I was able to work around this by disabling images entirely in Chrome, which might have other (performance) benefits, too.
Added this to the array of Chrome startup arguments:
--blink-settings=imagesEnabled=false
Of course, this only solved this specific case, in which the login prompts were being triggered by image URLs.

Calling toggleSidebar in Firefox's browser.js

I've seen numerous references to browser.js while trying to create a Firefox sidebar. I don't have a good understanding of what this file is though. It has a method toggleSidebar in it. Can I call that method from a web page? Can I call it from a browser extension? Do I need to include browser.js in my extension somehow first? Can I call it from the add-on SDK or is it only available from the old style XUL extensions?
I don't have a good understanding of what this file is though.
It is the code driving the Firefox browser window, lots of code actually.
Can I call that method from a web page?
No. You can use window.sidebar.addPanel() to add a sidebar however.
Can I call it from a browser extension?
Yes.
Do I need to include browser.js in my extension somehow first?
No, it is already included in the browser window.
Can I call it from the add-on SDK or is it only available from the old style XUL extensions?
You can use it from the Add-on SDK as well but you will need to access the browser window directly - either via one of the low-level modules or chrome authority.

opening default browser with delphi at specific position

I want to open a web page at default browser at a specific position and also open another webpages at that one, not new task of that browser. maybe user opens new task of that browser but by clicking a button in my delphi program the selected web page have to open at first one. is that possible? my company wants me to program such thing BUT I do not know how to do. I really appricate any help. thanks.
There are instructions here to open the default browser, but you may even be able to "run" a url, as you can from the Windows run command. You then need to retain the handle of that process so that you can do something with it.
To open a web page at a particular point you would ideally use a named anchor in the page, ie, the bit after a hash: http://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_a_name If you don't have control of the page and there are no named anchors you could try scrolling: How to scroll the scrollbar in external application via WinAPI?

How can I load iOS webclip links in the same window?

After loading up a Webclip with some links in it, clicking a link launches Mobile Safari instead of loading the link in the same window. Is there a way to prevent the link loading in Safari instead of the Webclip instance? I'm trying to mock up a mobile app just using PHP on my local Apache installation.
According to the Apple docs it looks like external page links will always open in Mobile Safari:
In this mode any external links will be opened in Safari on
iPhone, meaning that you will have to keep your web application to a
single page and use Ajax to update parts of that page.
In addition to the option of using a single page loading new content with AJAX, you can use the JavaScript self.location=URL; return false on hyperlinks that must stay within the application. This can be added to the HTML code directly, or with another script upon loading the page.
If you are using jQuery, I would recommend something like this:
$('a:not([target])').click(function(){
self.location = $(this).attr('href');
return false;
});
Obviously this script should be ran after the HTML has loaded, to ensure that it actually attaches to the A elements onClick event.

how to call 'onbeforeprint' function in Firefox

I'm developing one firefox extension. In that I need to inject some html elements, when print function is called, into the web page that has been loaded in the current browser tab. And then the page should be taken to the printer along with the injected html elements
I searched for and find onbeforeprint function in mdc
https://developer.mozilla.org/En/DOM/HTMLBodyElement
I'm unaware of using function. I tried using it as an event.
window.addEventListener("onbeforeprint",
function(){alert("Print called");}, false);
But it fails. Please, kindly help me in this regard.
As I understand, this feature was added just recently, and will only be available in Firefox 5 or 6.

Resources