Open a Internet explorer/Firefox etc window with Chrome - javascript

I'm building a smaller Web Builder with Javascript and I want the user to be available to preview their page in all the major browsers. Because that the tool only is available for Chrome I need them to get the chance to open a Internet explorer window with the same information, and the same for Firefox and Opera and Safari... Is there a way to do so, in Javascript?
P.S. The information that should appear on in the window is stored in a variable.

If JS can call firefox.exe, it could also call nasty_trojan.exe. The best you can do is generate a custom link server-side, and say "paste this link into your other browsers.
Unless you'd like to be really fancy, in which case you need to render the pages server-side, ala http://browsershots.org/.
There's a chance it could be done if you wrote it as a chrome extension, because those have some measure of trust, but the JS on a page stays very much inside its sandbox.

This doesn't belong on the answers, but I did not see how to comment (I am new, sorry!). This may help. It seems you may need to use a java applet, at least, I'm seeing that in a few places. Hope I've helped!

Related

Internet Explorer minimises on page load

We have a couple of sites that use a bespoke CMS (e.g. www.trident-ha.org.uk). In these sites whenever a link is clicked in Internet Explorer the browser will minimise for no particular reason.
This is obviously very frustrating and although we have found a few mentions from other people with this problem nobody seems to have a solution.
Presumably this is something to do with JavaScript but it has us baffled.
The only code I know to "minimize" a window would be window.blur(), which actually just removes focus from the window. It works across browsers, so is it possible that there's some IE-only script with this included?
FWIW, I suppose it could also be window.resizeTo(), although I suspect you would have set it resizes the window to very small dimensions if that were the case. Really, scan through all the JS files you load looking for any window.* functions, as those will be the culprit. There shouldn't (knock on wood) be that many because they're a pretty heavy-handed way to control the user's experience.

Prompt user to "Open firefox" if the website is opened in "IE"

I have a website,which is "currently" designed & tested to work only on firefox.If user tries to open it in other browser then I want to show a popup saying "This site works best with Mozilla Firefox. We're working hard to add support for your favorite browser. Meanwhile, do try it with Firefox."
Can we provide a buttion on clicking of which, one new window will be opened in firefox preloaded with some URL ? and also tells us in case firefox is not available at its default location ?
Thanks,
Sourabh
If you make your website standard-conformant, chances are pretty high it will work in Firefox, Opera and WebKit-based browsers (Safari, Chrome), without having to use much browser-specific code. Problem is, as usual, with IE. To achieve best results, write a website for standard-compliant browsers, then add hacks to make it work in IE.
You cannot detect installed applications on client computer, nor launch any of them - beacuse of security. All you can do is to do browser sniffing. You can do it on server side (by examining User-Agent header), or on client side (using JavaScript to check window.navigator object). It is quite complicated and error-prone though and certainly not forward-compatible (future browser versions may confuse your scripts). Moreover, users can change their browser's identification. When you detect unsupported browser, you could display some popup asking user to switch browser.
If you want to detect only IE, you can use IE's conditional comments, which is a most reliable way for detecting IE.
You can't test for Firefox being available nor start it using JavaScript. That would create big security holes...
You can try to figure out if the current browser is Firefox and output a message, although I really hate them (remember that not every visitor will be able to install/use another browser, e.g. within companies or public places).
If it only works on one browser, it isn't a website.
Sometimes we have to rush our work and compromise, but there is a cut-off point where more time is the only sensible option. Making your website multi-browser-compatible is one such example.
However, if you have to detect the user's browser, you could look at quirksmode. Mozilla have good article on browser detection, and the related issues.
A better alternative to browser detection, would be feature detection and Modernizr is very good at this.

Is there a way using jQuery or Javascript to force a page to open in Firefox?

Is there a way using jQuery or Javascript to force a page to open in Firefox? For example, if the user has their default browser set to internet explorer, but they have firefox on their computer - open a new firefox window with the intended page. If so, I would need to check to see if they have firefox on their machine; otherwise, redirect to the mozilla firefox download site...
any suggestions?
The answer, simply, is no. They don't have file system access like that for security reasons. You can probably imagine what would happen if, say you wrote a program that could crack open QuickBooks and take a look around. If you're worried about compatibility, you can use JavaScript checks to notify them that your page needs to be viewed with Firefox and refuse continuation until they get that settled.
http://www.quirksmode.org/js/detect.html
Or, you know, do it the old fashioned way and build a web page that is cross-browser compatible.
Alternatively, ActiveX might be able to do it, but the user has to accept permissions, and this is highly shady activity.
No. Web browsers do not provide information on other applications installed on a system. It would have security ramifications, such as presenting a fake McAfee antivirus dialog to folks who had McAfee antivirus installed.

Javascript to open multiple tabs in single browser

Does anyone know how to open multiple URL's in a single browser.
Instead of opening multiple windows, I want the urls to open in tabs in IE.
I am trying to approach this using JavaScript.
This strictly is a user preference in the browser and never try to override that.
For actual browser tabs, the only thing you can do is add the target="_blank" attribute to links. This may open tabs, but it may open windows instead. It's a user preference, like phoenix said. (By the way, Firefox, Chrome and Opera all opens "blank" targets in tabs by default.)
The other solution is to use Javascript tabs within the page itself. If you use jQuery, there are some plugins mentioned on this article I just read. Otherwise, do a bit of Googling for pure JS solutions.
What about if it's Internet Explorer only?
Also, Greg's original question was about JavaScript but would it be possible to make a simple ActiveX/.NET object that could do this and you could call from JavaScript and pass URL as a parameter?
You can say "never try to override that" but if the user is in a closed environment in which the browser us under control of the administrator, then the user has no choice. Browsers are used for much more than the web. A browser on a corporate site does not belong to the user, it belongs to the corporation.

Finding the currently logged in user from a Firefox extension

I'm writing a Firefox extension that needs to know what the username of the currently logged in user is in Windows, Mac, or Linux. So if I'm logged into my machine as "brh", it'll return "brh". Any idea how to do that from extension JavaScript?
Firefox extensions play by different rules to normal JavaScript running in the page: finding the current user is absolutely possible.
Open your Error Console (in Tools) and enter this:
Components.classes["#mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get('USER')
The environment variables Firefox was started with are available through that NsIEnvironment XPCOM component.
You may have to customise this per platform. If all else fails, you might be able to create an NsIFile in ~ then look at its .path; I'm not sure if shell expressions are honoured there, though...
The flagged correct answer works fine. I use this in our extension on Firefox 38. I also use events so that the page can communicate with the extension and retrieve windows properties from the extension.
getWindowsProperty: function(prop){
return Components.classes["#mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment).get(prop);
},
Don't think that's possible, seems like it would be a security hole if it were.
Yea, not possible... Javascript runs in a secure enviroment, and all FF extensions are javascript so you wont be able to be doing much interaction with the OS... but ill stick around to see if someone knows a way(it would be VERY cool...)

Categories

Resources