Is there a way to do object detection from JavaScript and force open a link in a specific browser?
For eg: Open in IE, Open in Firefox
No. Definitely not without some browser plugin. This would be a huge security risk if it were possible.
Related
My company is using Windows Edge as our default browser (so our intranet home page is loaded in Edge). Some external links in our intranet can be open/print from Chrome without any problem, however, the issue begins if the URL is open from Edge.
Can we use JavaScript to force certain links to be open on Chrome from Edge?
I tried
var shell = new ActiveXObject("WScript.Shell");
shell.run("Chrome http://...");
I got ActiveXObject is not defined.
You can't use Javascript to do that. For security reasons, Javascript is sandboxed in your browser.
See this question for more info.
There are plugins that can do that, but this would require installing them on everyone's computer.
ActiveX is not supported in Edge. So no, that won't work. And, since JavaScript alone is not allowed to access OS resources, you won't be able to accomplish this.
We have an old .asp page application that runs only in IE. The problem is, most of the users are using Chrome or Firefox. Is there anyway possible to force a specific link to open in a different browser? I read that it is possible with URI SCHEME, but I wasn't able to find any good explanation.
As I mentioned, this is ONLY for intranet purposes. I know that it's impossible for users outside of the network.
Thanks
We are using Google Apps at our company and everyone has Chrome installed on their computers. The problem is that we still have to use IE for certain things. I have a few html files on our intranet site that link to Google Docs, but it's opening in an IE browser. I need it to open a Chrome browser so the user doesn't have to sign in each time they open the file. I only have control of the html files settings so is there any way to use Javascript to force a window to open in Chrome?
Thanks!
I believe that if you're using IE you can use ActiveX to open up specific programs.
For instance try looking at 'new ActiveXObject'
You must explicitly allow this however as IE confirms if you want to allow it to be executed.
function loadProg(path){
var active = new ActiveXObject("WScript.Shell");
activeX = active.Run(path);
}
If you know the direct file path use this like
loadProg(path);
More specifically like
window.onload = function(){
loadProg("\"C:\\Program Files (x86)\\Guitar Pro 5\\GP5.exe\"");
};
I don't know the path to Chrome so i used something else instead.
Check if current browser is chrome:
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if not, alert user to show a message.
Are you asking if you can open a Chrome window from Javascript in an IE window? If so, then no, this is not possible. Javascript code in browsers run within a very strict sandbox that would not permit you to make any system calls. Opening a Chrome window from IE would effectively require you to execute chrome.exe on the client's machine. I'm sure you can see how this ability, if granted, could be misused to execute malicious exe's on the client' system.
I am quite sure that the best you can do using JavaScript is show a message to the user and tell them to open the file in Chrome instead. JavaScript does not have the right to execute an external application such as Chrome. See http://www.w3schools.com/js/js_browser.asp for information about detecting the browser using JavaScript.
I wrote a scripting logic in using ActiveX. When the application runs it is blocked by popup blocker. When I enabled it works fine, but I want to enable the popupblocker using JavaScript (especially in IE).
Obviously a website cannot modify the popup blocker settings. And that's a good thing.
You should avoid using ActiveX Controls because it is only supported by IE. Trying running your page on Firefox and it won't work.
Now the actual problem -
Firstly you need to understand what ActiveX Objects are used for? They basically allow a web application to interact with the client machine. For example it can use resources on my local hard drive. This is a security risk. So IE gives a warning for the same. You may disable it in your browser by going to Tools-> Internet Options -> Security Tab. Click "Custom Level" and change all the boxes with ActiveX text in it to "Enable".
But it will still show up in your client browsers.
So the point is try finding an alternative for it.
Hope this helps!
You cant. What you could do is have a message on screen which requests the user to turn off the popup blocker .
Is it possible to get urls of all the tabs open in the browser from java script...Is it any browser dependent thing ?
can you do this with javascript in a page? no, the browser sandbox will block it for security reasons.
Can you do this with a firefox add on? yes you can do this if you use jetpack on firefox. There is an api that allows you to see the tabs. It works by sitting in chrome part of firefox which has special privileges