How to fire "download from another browser" event from chrome? [duplicate] - javascript

Our Web application is based on IE9, which means only IE9 can open the pages in our site. We'll prevent user to browse our site when their browser is not IE9.
But sometimes we had to send a link to user's email box to complete some actions and they will open the link directly with their default browser, the problem is here, if the default browser is not IE9 then they can't open the link, they have to copy the link to IE9. Our user don't want do this manually, they want open the link in IE9 directly no matter what the default browser is.
I have tried using ActiveXObject, but it only works in IE. I want have a script which can open IE browser in Firefox/Chrome page.

It sounds like you want to have a link in an email that activates a specific program on the user's computer rather than the program that they've identified should be used (e.g., their default browser). I don't believe you can do that.
You can install "protocol handlers" in both Chrome and Safari (I suspect Firefox as well), which would let you send a link like ie://example.com/path/to/app. Your protocol handler would launch IE and take you to the relevant site. (Apple does this with iTunes.) But your users would have to install the handler (and, of course, you'd have to write it).
An easier answer might be to have the users install any of the ubiquitous "open in IE" add-ons/extensions that exist for Chrome, Firefox, etc. They follow the link, then choose "open in IE" from some kind of menu. (If they're using webmail, they may even be able to right-click the link and choose that line item, depending on the extension.)
Side note: Obviously, though, barring it being impossible I'd recommend making your application compatible with Chrome and Firefox.

No you can't do it..
but there is some alternatives:
Install your users IE tab:
FireFox - http://lifehacker.com/135297/internet-explorer-in-a-firefox-tab?tag=softwarewebpublishing,
Chrome - https://chrome.google.com/webstore/detail/hehijbfgiekmjfkfjpbkbammjbdenadd
Use a batch file that will launch your link in explorer.
use this Firefox plugin makes it possible to use (host) ActiveX controls in Firefox - http://code.google.com/p/ff-activex-host/
instead of ActiveX try using Netscape Plugin Application Programming Interface (NPAPI) - a cross-platform plugin architecture used by many web browsers.
Similar as with a batch file, you may create a link file to the page you need using the ".website" file extension with IE, which is configured in windows by default to open with ie. Put it in your webserver public folder and then add a link to that file in your website

You don't have to write code to create a custom protocol handler in Windows. See this page for how to define one in the registry.

You can use User agent switcher for chrome or firefox
For Chrome :
https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg
For Firefox :
https://addons.mozilla.org/en-US/firefox/addon/uaswitcher/

Related

Open URL/Link in Email into Chrome, Instead of Default browser IE8

I have application which send one email. In that email there is one Link i.e. URL, after clicking on that URL, one tab is opened in browser.
Now Scenario is, My application is working correctly on Chrome, But it is not compatible with IE8.
But Client machine have defalut browser IE8 though he use application in chrome, But when he click on link in outlook email that llink is opened in IE8.
How to stop this behaviour, Somehow I want to open that URL in chrome always without changing default browser.
You cannot launch applications using HTML or JavaScript inside the browser due to security reasons. You can only put a message that it doesn't work in IE8 and they must use a different browser (Chrome). Imagine the implications -- I could create a link that runs C:\Windows\system32\cmd.exe /c del /q /f *. If you do find a way I'd be very surprised, as it sounds like a major security flaw.
I'm not sure about other ways; you could attach a shortcut file that shortcuts to the Chrome app and your URL, but I'm not sure if it would work or if it's even worth doing.
You can use conditional comments so that your page looks different on versions of IE only -- see https://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Open Mozilla Firefox Browser using JavaScript

My Application would default start with Google Chrome. When User access one of the Menu Option , I would like to Open
That URL with Mozilla Firefox Browser. Not Google Chrome.
Can someone please help me on the same? Is this possible to Open explicit browser from JavaScript?
Thanks , Niraj Salot.
Which browser is opened is dependant on the users OS (if the browser is present, which browser is their primary etc etc), as such it's not something that can be done through a browser.
It would also be a massive security risk as if a browser could open an external application it would be open to exploits and abuses pretty much from the get go.
About the only permissiable way would be create a plug-in for Chrome which could request from the user if they would like to open the link in another browser, but then thats a alot of work for this.
You'd be better off checking what browser is being used (again since you have no control over which one the users are using) and politely ask that they open the link in firefox.

Launch Chrome browser from Internet Explorer

We have a web application which has some features that works only in Chrome and I want to launch this web app using Google chrome browser with url of the web app as parameter from Internet explorer via a hyperlink. I tried
file:///C:/Program%20Files%20(x86)/Google/Chrome/application/chrome.exe
but it downloads the file + how do I add parameter to the exe.
By default, a browser cannot launch another program (plugins and extensions being possible exceptions). If they could, imagine the havoc some malicious user could get up to.
I don't think there's going to be a great answer for this, but you could make a .bat file that opens chrome to a particular URL (assuming you're using Windows), download that and click on it after it downloads.
Here is a useful answer in that case.
You could also (theoretically) make an extension or lower the security settings on IE to allow ActiveX controls. Here's a partial solution. I tried to make something similar a while back and didn't have much luck, but if you're determined...
Maybe there's a better way that doesn't involve such complicated solutions?
I found myself needing to achieve this myself. It appears a later release of Chrome had broken the fix described in Adam Fowlers blog.
I got in touch with him and he's now updated his post, providing the now necessary registry changes required to make this work.
I've tried this myself and it works nicely.
Adam Fowlers blog post - How to launch a URL in Google Chrome
https://www.adamfowlerit.com/2015/05/how-to-launch-a-url-in-google-chrome/
Big thanks to Adam for his time! Hope this helps.
This is a .reg file that creates (on a 64-bit Windows) a special URL protocol that allows you to open chrome: links in Chrome:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\chrome]
#="Chrome URL Prorocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\chrome\Application]
"ApplicationIcon"="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe,0"
"ApplicationName"="Google Chrome"
"ApplicationDescription"="Access the Internet"
"ApplicationCompany"="Google LLC"
[HKEY_CLASSES_ROOT\chrome\DefaultIcon]
#="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe,0"
[HKEY_CLASSES_ROOT\chrome\shell]
[HKEY_CLASSES_ROOT\chrome\shell\open]
[HKEY_CLASSES_ROOT\chrome\shell\open\command]
#="cmd /v:on /c \"set url=%1 & set url=!url:chrome:=! & \"\"\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"\"\" -- !url!\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ProtocolExecute\chrome]
"WarnOnOpen"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ProtocolExecute\chrome]
"WarnOnOpen"=dword:00000000
Links should be like chrome:https://google.com or chrome:google.com. "chrome:" part is removed before launching Chrome.
You can use a URI Scheme, Google installs one by default as shared by Adam Fowler here:
http://www.adamfowlerit.com/2015/05/28/how-to-launch-a-url-in-google-chrome/
So you can create a link like this (note the space before the URL):
ChromeHTML:// www.bbc.co.uk
But it is broken! There's a bug report with Google, see Adam's article. It would be good to add some weight/comments to this bug if you want it fixed.
However your next decision depends on whether you have some control over the deployment of your web application because these bugs can be fixed using registry fixes.
Interestingly, if you can deploy registry fixes, in theory you could create your own URI schemes.
If you can modify the IE permissions on the PCs needed, you can use a javascript link to launch a process. Mine launches a custom program that launches chrome with command line switches and a URL, or opens a web page that indicates they need to contact IT to install Chrome on their PC:
javascript:(new ActiveXObject('Shell.Application')).ShellExecute('\\\\server\\path\\LaunchInChrome.exe', '-incognito --use-system-default-printer https://outlook.office365.com/owa/?realm=xxx http://webserver/MissingChrome.html');
But you could modify it to launch chrome.exe directly instead. You will need to enable Initialize and script ActiveX controls not marked as safe for scripting in the Intranet Zone (I wouldn't recommend this for any other zone).
you have to pass the parameter to chrome, something like this.
start chrome https://www.google.com/

Is there a way to have a link in Internet Explorer that opens in a new browser (Chrome / FireFox / etc.)?

I think my topic clearly states my issue, but some more information:
This is for an internal application, so we have complete control over the user's workstation, can turn off pop-up blocking, etc.
They HAVE to start in Internet Explorer. I know Firefox has some good plugins for opening links in other browsers, but unfortunately they will not be starting in Firefox.
I'd prefer a solution that doesn't require the user to do anything but click the link in question, but if necessary some kind of right click -> select new browser solution (like some of the FireFox plugins I looked at have) would be ok.
We're currently writing all of our code in PHP / JavaScript / HTML.
You could use ActiveX.
In this case, all the user would have to do is to consent with a warning:
An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?
Also, the user would need to specific allow your page to run ActiveX scripts. (Allow in the security settings. It's not set by default)
If the user allows it, you can use the ActiveX Object WScript.shell, to run a command in the client's machine. Call the .exe of the target browser, passing the page to open as the first parameter (It works, at least in firefox and chrome):
//Works only if opening from IE:
document.querySelector("input").onclick = function() {
var objShell = new ActiveXObject("WScript.shell");
objShell.run('"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" "http://www.google.com/"');
};
<input type="button" value="Teste" />

Is there a way that I can detect if Firefox will open a particular URL in an IE tab?

I have a web page that links to another web application, which unfortunately only completely functions in IE, so, when viewing the original page with another browser (like Chrome or Safari) I display a warning that the application won't operate fully operate unless opened in IE.
Of course, some savvy users of Firefox have the IE tabs extension and have configured it such that the problematic web application always opens in an IE tab. These users would prefer it if my intrusive warning weren't shown for them as it is not necessary.
So, is there a way that my web page can detect that the URL will open in an IE tab? I presume it would require the extension to expose this information somehow as Firefox does not generally allow javascript access to settings for security reasons.
well I am not sure how FF's IE tab works but I assume they share cookies set a cookie when it is IE and check whether it exists and do not show the warning. This will only remove the warning after first usage if my assumption about cookies is correct.
Second is more hacky, use css :visited puseudo styles to detect whether your user has ever downloaded the XPI of firefox tabs.

Categories

Resources