Running COM objects within Firefox or Chrome - javascript

This question has been asked many times before: How do I run COM/ActiveX control in other browsers other than Internet explorer. The answer i simply "No! Rewrite your code. It is not recommended, security issue" and so fort.
However, I am in a situation where I can not choose.
The company I work for has a webbased CRM system that we have developed ourselves. Now we want to add phone functionality to it. MakeCall, Hang Up, Answer and so on. The PBX vendor we have chosen has software installed on evry PC that allows this functionality to be called thru a COM-object.
So we have made some tests using Internet Explorer (using new ActiveXObject() ) and everything works great. However, we have a company policy that it must also work in Firefox and Chrome. So, I am searching for a solution, that I hope all of you can help me with.
How can we do this in other browsers? Can I make a plugin that wraps the COM object? Keep in mind, the only way to communicate with the PBX software is to use this COM-object. Security is not an issue as this web solution is only used in-house and we trust the software (COM-object.)

You can use the whole of internet explorer as a plugin in Firefox/Chrome using the IE mode. This essentially embeds IE within Firefox which then hosts the ActiveX control.
The same extension for Chrome is here.

Related

Silverlight browser compabibility script

Now that we have a couple of web browser not supporting Silverlight, I would like to create a better experience for my users, informing about this compatibility issue and guiding them to use Firefox, IE or Safari(maybe).
The current Silverlight plugin detect script leads to bad user experience, since it keeps prompting user to install the plugin, even if it is already installed. In my opinion, it should inform about the incompatibility, if it is the case.
Microsoft Edge has a great feature that detectes some incompatibility sites and shows a great message orienting to proceed with IE instead. But this does not apply to my website. You can have a look on the message in this article:
http://www.thewindowsclub.com/edge-displays-this-website-needs-internet-explorer-message
How can we make a mix of both features and solve this problem?
Thank you,
Igor.

Does Firefox have a standard API to check installation of specific Addons?

I'm trying to detect the presense of certain addons that restrict functionality on our sites (such as Ghostery, or DoNotTrackMe), using plain JavaScript. If Firefox had a standard API to query for the existence of addons, it would short circuit my work. Probably something like:
AddonManager.getAddonByID('?')
Detection is possible for plugins such as Java and Flash (navigator.plugins), but not for addons, yet.
Detection is also possible if you are the developer of the addon.
No, there is no such API and there won't be. If the browser allows websites to detect what extensions are installed then it is a bug and a privacy issue - Firefox and Chrome fixed such issues in the past, currently no such issues are supposed to exist. Why webpages shouldn't know this:
The add-on list allows fairly precise fingerprinting of users and might allow tracking users even if cookies and similar mechanisms are disabled.
Attacking vulnerabilities in extensions gets a lot simpler if a website can check in advance whether a vulnerable extension/extension version is installed. Same goes for social engineering attacks that rely on the presence of particular extensions.
There is always a chance that websites decide to exclude website visitors that have unpopular software installed (ad blockers of all kinds, vulnerability scanners, download helpers etc).
The list of installed extensions tells a lot about the user, his browsing habits and preferences - providing this information to websites would be a huge privacy issue.
navigator.plugins functionality shares many of the same issues of course - it was introduced in the dark ages of the internet back when nobody considered such issues. This is the reason why this functionality is being actively discussed and might get limited in future.
Now of course websites can still try to detect extensions by their effects. However, this isn't a very reliable approach, e.g. the Adblock detector you linked to says "no ad blocking detected" to me and is clearly wrong.
Bonus info: Google Chrome does provide a list of installed extensions but only to a single website: Chrome Web Store. The Web Store uses it to indicate which extensions you already installed. Whether it does anything beyond it with that data is something where your guess is as good as mine.
You can detect AdBlock in FF, IE, Chrome
http://adblockdetector.com/
You can detect FlashBlock in FF, IE, Chrome and others
https://gist.github.com/artlung/1420308
https://github.com/browserstack/flashblock-detector/blob/master/flashblock-detector.js
You can detect Ghostery in Chrome
http://blog.securitee.org/?p=277
Please note these scripts use inference to detect the presense of these addons, there's no API. I haven't found detectors for other addons but they possibly exist.... (ongoing)

How to debug web app on windows mobile (7 and later) [duplicate]

I'm not a Windows Phone developer, and I want as little to do as possible with anything related to Microsoft. Nonetheless, I need to get my mobile web app running properly on Windows Phone 7. What debugging tools are available for the platform? Something like the Webkit developer tools or Firebug would be ideal, either from the phone itself or more likely, remotely debugging from my computer.
If such a thing doesn't exist, I'd settle for being able to read Javascript error messages, and view the contents of variables using alert() or similar. At this point, all I know is that my JS is failing: I don't know where or why, let alone how to fix it.
My dev computer is running OS X, and I'd really like to be able to use these tools from OS X if possible. Assuming that debugging tools exist (which I really hope they do) are they designed for Windows only? If so, does anyone know how well they would work with Wine or similar?
EDIT: I have a physical Windows Phone 7 device, so I can use that. However, alert() doesn't seem to be working, which is why I'm posting this question. Does alert() normally work on the WP7 browser?
You'll likely find the Mobile Perf Bookmarklet to be the easiest all-in-one tool for testing any mobile device.
Works well on the iPhone/iPad/Samsung Galaxy Tab in my testing so far.
Quote:
It displays a menu with links that load other bookmarklets including Firebug Lite, Page Resources, DOM Monster, SpriteMe, CSSess, and Zoompf.
Unless you have a Windows Phone 7 device, you will need to run Windows in BootCamp and install the Windows Phone Developer Tools in order to test in IE on the emulator. I don't know about Whine, but I ran into major problems trying to test in Parallels - so based on my experience, I suggest keeping it as simple as possible.
There is no console in IE on the phone, so you will need to use alert, like you suggested, or just write text to a div on your page as a custom console.
If you really want to code in OS X (which I definitely understand), using a separate machine for testing IE in the WP7 emulator is going to be your best bet.
EDIT: I just tested alert and it did work fine on my Windows Phone. My guess is that a syntax error is preventing it from calling.
The following may be interesting
Simple IE debug tool for Windows Phone
Supports
Html traversing
Html node styles, properties, metrics
Reading console output
Executing js on device side from console (including intellisense)
Dynamic script injection - ability to debug live sites
Not supported
js breakpoints
Just wanted to add a note to say that full JavaScript debugging is possible now with Windows Phone 8.1 and Visual Studio 2013 Update 2. Full details are available at:
http://blogs.msdn.com/b/visualstudioalm/archive/2014/04/04/diagnosing-mobile-website-issues-on-windows-phone-8-1-with-visual-studio.aspx
I realize that this doesn't help the versions referenced in the original question (WP7), but I'm hoping this will help people who may find this question and are running a more recent version.
Something that has worked for me, is to test my mobile pages through the Windows Vista built-in Internet Explorer browser.
It comes with a script debugger ( which you have to enable in Advanced Options tab through the Internet Options menu ), and it seems that it gets really close to the Internet Explorer Mobile implementation.
Another tip would be, that, instead of using window.alerts, you can also use document.write or set output to a div content.
I'm using this hack to have console.log send info back to the server (it uses window.fetch, which I'm polyfilling, but could use xhr instead) https://gist.github.com/wheresrhys/bf93057ee3a594454582

Create Internet Explorer extension changing content of a webpage

I'd like to develop an Internet Explorer extension that changes the content of a specific webpage, like content scripts in Google Chrome. (eg. when I go to the website Google and I search for "car" I'd like to have a div created on the page with the word "car" inside).
I've been looking on SO but haven't found clear evidences if this kind of thing is possible.
What I'm specifically looking for is a clear tutorial or some example of how to do this.
Bruno,
That is exactly what GreaseMonkey for IE is made for http://www.gm4ie.com/
I have answered a similar question, but the answer is in C#. It describes how to create a fully working project to accomplish exactly what you asked: changing page contents!
How to get started with developing Internet Explorer extensions?
It covers other topics too:
running javascripts from the addin
how to register IE addins
saving data (addin configurations)
You can read more about Internet Explorer Extension from MSDN:
http://msdn.microsoft.com/en-us/library/aa753587(v=vs.85).aspx
Extensions in IE are not created using web technologies, they are created using C++/.NET. Such as ActiveX
Similar to "GreaseMonkey for IE" is Trixie:
Trixie is to Internet Explorer as Greasemonkey is to Firefox. It lets you remix the Web via scripts. You may do this to either make it more readable, fix bugs or to even add little features to make the site more usable to you. Trixie by itself does none of this. It is just a plugin for Internet Explorer that enables executing chunks of JavaScript code and thus lets you use the Web the way you want to use it.
This is one of the best I found. http://www.enhanceie.com/ie/dev.asp It has give sample scripts as well. Which will help you.
Another one is open source and stable version : firebreath
same kind question is also asked How to get started with developing Internet Explorer extensions?
This is a working example of manipulating the DOM from microsoft. This is a BHO development with MS Visual Studio. Check it out: http://msdn.microsoft.com/en-us/library/bb250489%28v=vs.85%29.aspx

Is there a way to port a chrome extension to other browsers?

Is there a way to port a chrome extension to other browsers, without having to entirely re-write the code? My chrome extension uses the browser_action command to open "popup.html" in the extension window...
Update: I found adblockforchrome port.js and found it only somewhat helpful for porting to Safari...
Apple provides some guidance on how to port convert a Chrome extension to Safari, but the problem you're going to run into is that each browser has a different set of allowed functionality for extensions. Even with Chrome to Safari, there are things you could do in Chrome you can't do in Safari, and visa versa.
It depends on the type of the extension, but not really. To answer your question more clearly, you need to specify what your extension is about: modify some pages (like userscripts/userstyles), extend browsers' features, or something else.
There are a few portability notes, however, that could help you to simplify this process:
Don't write browser specific code. In some modern browsers you're able to use HTML5 features, like Web SQL Database API. It is difficult to emulate such behaviour on IE, for instance.
Keep your JavaScript modular; don't use vendor specific JavaScript methods, and your code will be portable and will not rely on TraceMonkey or V8;
Separate HTML from CSS and Javascript, don't make your code dirty and complicated.
Jumping in a bit late.
Our company - Slice Factory (full disclosure here!) does provide a browser extension conversion service: http://gallery.extensionfactory.com/labs/conversion/
In most cases your chrome extension will work seamlessly in FF and Safari.
The service is still in beta trial, and Firefox conversion is working better than Safari one.
I can't fully disclose what's our technical solution, but this being an SO answer, I can add a few details: we have re-developed a full javascript api stack that mimics most of chrome extension APIs for Safari and Firefox; in Firefox we base our work on JetChrome. Plus we have wrappers that re-package the chrome extension adding our library and rewriting manifests and so on.
Beyond that, it's mostly a few good ideas, trial and error, and a LOT of development time.
As an example:
Safari 5.1 just introduced a popup corresponding to Chrome's browser_action, but we have already an alternative solution that works for previous versions. Firefox does not support HTML5 WebSQL, but we have an API for it. We also provide a way to bring webapps to FF, and soon to Safari.
The objective is to have Chrome API as a reference, and mimic it on all the other browsers.
Without pushing you towards our solution, I might add that the time to fully cover the Chrome API on both Safari and Firefox is probably not worth it - unless you plan to convert several extensions. So for just one or two extensions I would advise making your code as modular as possible, and just creating three extensions - or trying our service!
Yes, it's possible with Webextension API using webextension-polyfill.
I made use of it to build this where I only had to change the callback methods to Promises and using browser.something instead of chrome.something to call the browser APIs.

Categories

Resources