Launching an executable from the web browser via link - vb.net

I've seen a ton of games and what not opening their applications using links like "game://15.64.15.64:25876" or something.
I want to be able to launch my game's .exe from my website for users who installed it, and for it to work on any browser; At the same time I want to be able to pass a parameter (just 1).
What registry values would need to be added/modified for this to work for all browsers? If there's extra steps to setting it up in all browsers, can you explain these steps? Other questions I've found didn't quite help or worked only in IE. I require Firefox, Chrome, and IE at the least.

A similar question was asked here:
How do I make the website execute links?
You would end up with a structure like this in your registry:
HKEY_CLASSES_ROOT
game
(Default) = "URL:Game Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "game.exe,1"
shell
open
command
(Default) = "C:\Games\YourGame\game.exe" "%1"
See this article on MSDN for details:
Registering an Application to a URI Scheme
As mentioned by OP, the above approach only works in IE. Here are some thoughts on how to make it work in other browsers:
Chrome: Is it possible to open custom URL scheme with Google Chrome?
Firefox: Writing a Firefox Protocol Handler

One way I can think is download a file from browser ( gamesession.gme or your extension)
and set your game as the default application for that extension.

Related

Firefox Ignores Content-Disposition

I'm trying to write MVC endpoint that will optionally set the content-disposition to inline or attachment in order to either display the file (a pdf) inside a new browser tab or else to download it. The UI allows the user to select how they'd like to open the file (not my design - can't change that aspect of it).
Note that this works in Chrome/Edge just as expected.
In Firefox, the application settings for PDF appear to trump the content-disposition. Is there a reliable way to get Firefox to respect the content-disposition? Preferably a way that will work w/ a vanilla installation of the browser such that end-users don't need to make any modifications on their end for it to work.
Here's the code I'm using to setup my response (class is derived from ApiController):
var response = Request.CreateResponse(System.Net.HttpStatusCode.OK);
response.Content = new PushStreamContent((stream, content, context) =>
{
dispatcher.Dispatch(request, stream);
}, new MediaTypeHeaderValue(MediaTypeNames.Application.Pdf));
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue(contentDisposition)
{
FileName = $"{auto_generated_fileName}.pdf",
};
response.Headers.CacheControl = new CacheControlHeaderValue()
{
NoCache = true,
NoStore = true
};
return response;
We have noticed this issue in our webapp as well. The webapp has a download button that lets the user download a PDF file. Firefox shows the PDF file in the current tab, which effectively kills the webapp.
After a bit of research, this appears to be an intentional feature, see the release notes for Firefox 98:
When you set an application to open files of a specific type in your Firefox preference settings, those files will open automatically, even files served by the website with "content-disposition: attachment". The same applies to PDF files that are set to open in Firefox by default. This is a fix to bug 453455.
Personally, while I can understand some users may want this for web pages that don't behave well, this is an issue for well-behaved web apps.
Setting the download attribute on the anchor does not appear to work either, Firefox still shows the file inline (tested with Firefox 99.0)
So as far as I am aware, you cannot force the browser to download the file if the browser does not allow it. Other web apps such as OwnCloud or Google Drive are having the same issue -- if you click right on a PDF file in Google Drive and then click on Dowload, Firefox still open the PDF file inline, whereas Chrome downloads it.
For now, it seems the best you can do is to open file in a new tab, to prevent the webapp or web page from being replaced by the downloaded file (which is also what Google Drive seems to be doing). You can open the download in a new tab or window e.g. via the target attribute on an <a> links or via the formtarget atttribute on a <button> element.
I found #blutorange's answer after trying to find a solution to the same problem as OP. However, just before I got here, I stumbled across this answer from back in 2013 - https://stackoverflow.com/a/16515146 which suggests to set the Content-Type header to application/octet-stream, instead of application/pdf.
I tried that solution and what do you know - it works! The PDF opens in a new tab in Firefox automatically, but at least it doesn't replace the tab of my application, so yay! Chrome doesn't seem to mind it either and my PDF viewer on my computer also recognizes the files as PDFs.
Now, this might not be the most "correct" fix to the issue we're facing, but it's an alternative to forcing open a new tab.

How do some sites automatically open in Edge when tried to open in IE11?

When I try to browse to netflix.com (for example) in IE11 (on Windows 10), IE11 shows a page with the title "We recommend viewing this website in Microsoft Edge", and the site automatically gets opened in Edge.
Does anyone know how that works? Is it done via an internally compiled list of sites or something I can set up on my website?
Thanks
You had asked, "Does anyone know how that works? Is it done via an internally compiled list of sites or something I can set up on my website?"
When a user goes to a site that is incompatible with Internet Explorer, they will be automatically redirected to Microsoft Edge. For more detailed information, you can refer to the Redirection from Internet Explorer to Microsoft Edge for compatibility with modern web sites.
Microsoft maintains a list of all sites that are known to be incompatible with Internet Explorer. You can view the site list here. If you want to add your site to the incompatible site list then you can refer to the Request an update to the IE compatibility list.
The MS Edge 87 or greater browser installs the BHO named IEToEdgeBHO that performs the redirection based on IE compatibility list from IE to Edge browser.
You can find this BHO at the location below on your machine.
C:\Program Files (x86)\Microsoft\Edge\Application\<Your_browser_version>\BHO
If you want to achieve something similar using the code in your own site then you can refer to the example on this answer. The test shows results for the Edge legacy browser but it can also work with the Edge (Chromium) browser.
Note: that the example code mentioned in the answer may break when the Edge browser is not installed on the machine. so you can try to modify the example to handle that kind of situation.
Helpful reference:
What “magic” causes “cnn.com” when typed in IE11 to automatically launch Edge (Chromium)?
Netflix specifically is on a list of websites that automatically open in Edge when they are accessed from Internet Explorer. The list is maintained by Microsoft.
If you do not want to go through the application process to get your website added to this list, you can resort to detecting which browser the user is on and handling the notice yourself.
Here is a decent list of current Internet Explorer user agents.

Working with multiple APIs for Multi-platform apps

I currently have a Chrome extension that uses Chrome's APIs and plan on making a Microsoft Edge version once it opens up as well. My question is how do you work with the multiple API's?
For example, I use the following to check if the extension has just been installed or not:
chrome.runtime.onInstalled
I'm assuming for Edge it would be something like:
edge.runtime.onInstalled
What's the best way to work with both of these? Do I just duplicate the code within the file where there is a copy of the code for one and the other and presumably the browser will ignore the other browser's code? (doesn't sound like the good option)
Or is there some cross-browser framework that I should use instead?
Or is there some other solution?
And please forgive me, this is my first entry into building extensions/apps, I'm generally just a Web Designer.
Thank you!
All browsers support or
chrome.runtime.onInstalled
or
browser.runtime.onInstalled
So, the right way is to start scripts in your extension with this code:
var browser = browser || chrome
And then use browser, for example:
browser.runtime.onInstalled
(I'm sorry about my english)
Edit:
Chrome and Opera support chrome and not browser.
Firefox support chrome and browser.
Edge support browser and I don't know if it support chrome.
Anyway, my solution work in all browsers.
Update (5.8.16):
Edge support browser and not chrome.

Testing ssl HTTPS application locally with Coldfusion

I would like to test https related application on my local machine before pushing it to staging and production.
If I try to test on local system, the page just showing (in chrome it gets to the "This webpage has a redirect loop" page).
If any information could be provided that would assist me in setting this up / getting it working and testing, I would be extremely grateful . Thanks
This problem can have two angles whether this could be related to your specific browser or with your ColdFusion application:
First and foremost can you check it on Firefox or IE just to isolate if this is specific to Chrome. (As I have seen this to come on Chrome more than often)
if it works on Other Browsers:
probably Chrome is at fault. Go to settings (Options -> Under the Hood -> Content Settings -> Cookies -> Show cookies and other site data)
Enter your problem URL in search bar and it would list all related cookies.
Select "Remove all"
if it FAILS on other browsers as well:
Can you check with perhaps another test application?
Please check with following article by Ben Nadal --
http://www.bennadel.com/blog/1666-Ask-Ben-Enforcing-An-SSL-HTTPS-Connection-Based-On-Request.htm
If this persists, please add some more information, on how this has been set up.
Cheers,
Anjaneai
If I understand your questions you should be able to use a self signed certificate on your local dev box. Once you set this up you should be able to test your site in SSL mode.
Here is one quick tutorial.
http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx

One Click install for Safari Extensions

When a user downloads a plugin firefox (for example) the plugin installation begins as soon as the download has completed.
Is it possible to achieve the same thing in safari? i.e. user clicks link to download plugin, once it has downloaded it automatically begins the installation.
I don't think this is possible to do on any other domain except extensions.apple.com.
I've done some extensive testing on this and the safari.installExtension() method is only present if the domain matches extensions.apple.com (probably controlled by the browser, similar to how certain Chrome APIs only shows up inside of extensions themselves).
I tested this theory by going to the JS file itself and opening the JS console:
https://extensions.apple.com/home/scripts/extensionInstall.js
After that JS file has loaded, type typeof(safari.installExtension) in the JS console and it should return "function". Notice that it exists on a non-HTML page, meaning it's being provided by the browser (since this script doesn't execute, nor has the code in it to provide this method).
I tried doing this on other sites and it doesn't exist: "undefined".
I also had a crazy thought that it just needs extensions as the subdomain, so I tested it on http://extensions.joomla.org too, no dice. I can't seem to find an extensions sub-domain that's SSL though. That may work, but I seriously doubt it as the method appears to be regulated to only show up when on Apple's specific extensions sub-domain.
No solution for that here, but maybe this can help?
In apple extension gallery at https://extensions.apple.com the extensions do install in one click, and i wanted to achieve the same in a website of mine, so i went and checked their JS source code.
A javascript file there defines a "ExtensionOneClick" Object (https://extensions.apple.com/home/scripts/extensions.js).
A method is dedicated to installing extensions:
// href : path to the extension ".safariextz" file
// id : com.whatever.myextension-<safaridevelopper10charsid>
safari.installExtension(id, href);
I tried to replicate this on my website, but i get "safari is undefined", so I guess a site specific hack in Safari is helping here?