Create Internet Explorer extension changing content of a webpage - javascript

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

Related

Running COM objects within Firefox or Chrome

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.

Can we create browser extension for firefox using javascript

i tried to write a script which can be added as an extension to the browser. The problem with this script is how to access the dom elements of a webpage. i used XMLHttpRequest object for accessing the web page but it has same origin policy issues. I worked on it for nearly 3 weeks finally i used Anyorigin.com code but i am not able to get all the functionality so i thought of using userscript where we can easily access the web page's DOM elements. Is ther any other way to create an extension
While enloz's answers are good, Firefox has an Add-on Builder that you can you use.
Add-ons are built using HTML, CSS and JavaScript. There is a web based version with the following features (quoting from their website):
Edit code in a feature-rich environment
Test your add-ons instantly
Use built-in version control & sharing
You can find the web based version here: https://builder.addons.mozilla.org/
Try this:
Greasemonkey:
Customize the way a web page displays or behaves, by
using small bits of JavaScript.
https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
Update:
This looks to be a better solution, but I haven't tested it.
http://crossrider.com/

Can I force a link to open in a specific browser?

I have designed a website using Firefox and am now looking to integrate a softphone into the webpage, but unfortunately it is made with ActiveX, so Firefox won't support it.
I have tried opening my page in IE9, and it looks a mess because I've used CSS3 for a lot of it and haven't coded it for different browsers because we will only be using Firefox within the office.
Is there a way that I can tell my page in Firefox to specifically open a new page in Internet Explorer and just have the softphone in there? Or is there a way to get ActiveX running in Firefox with a plugin or something?
You can open a link in Microsoft Edge from any browser by adding microsoft-edge: in front of the url in the HREF.
EDGE (works)
I don't know how to get it to work in other browsers though. My team and I spent quite a bit of time on it and couldn't find a raw HTML/JavaScript solution.
I don't think you can open a IE window from firefox, but you can easily build a firefox plugin based on your activex using http://code.google.com/p/ff-activex-host/
It really depends on your exact situation.
If you are targeting multiple users outside a corporate network this is hardly possible to achieve. However, if you are targeting your company's network it's possible to do this using custom protocol.
Your link then would look like: ie://opens_in_ie.com
You'll have to make changes to registry of target computers though. More info about custom protocols is available here: http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx
In most cases, system administrator can do this remotely.
IETab V2 will let you open a tab within Firefox that runs the IE engine.
Once installed, you can force a link to open with IE by formatting the URL or bookmark like this:
chrome://ietab2/content/reloaded.html?url=http://domain.com
It's somewhat specific, but I created an internal site at work, and I wanted to link to another internal site that only works in IE. To do this, I created/defined my own application protocol in the registry. Then I added to my links the protocol header. This is similar to what apple does when you click a link and it opens iTunes. The downside to this approach, however, is that users will have to install the registry modification for it to work... like I said, it's really a solution for a very specific scenario.
Same answer as from chuck wallace
If you want to start from for example in Internet Explorer, go to C:\Program Files\Internet Explorer\iexplore.exe and create a shortcut to the Desktop.
When you check the properties from this created shortcut, you will see the Target: C:\Program Files\Internet Explorer\iexplore.exe.
Now you can place the shortcut from the website, behind the Target. It will show something like this: C:\Program Files\Internet Explorer\iexplore.exe www.nu.nl. Or this C:\Program Files\Internet Explorer\iexplore.exe https://stackoverflow.com.
This way it opens IE first and then the website.

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.

Firefox XUL toolbar with javascript to IE?

I have developed a Firefox toolbar in XUL, which uses javascript to manipulate the DOM.
I'd like to export this to IE.
I know that IE doesn't support XUL, but wonder:
(1) is there an easy way to use the existing javascript code for the IE toolbar as well?
(2) is there a IE installer that easily creates all necessary registry values for creating a toolbar?
I'd be grateful for any help. If anyone can point me to a sample IE toolbar code, with several buttons, drop-down menus and perhaps even a search box, that'll make things much easier as well.
Thanks!
Try AmpleSDK by using this you may port your toolbar to ie
Writing an IE toolbar requires C++, the Windows API and Microsoft COM. If you have the paid version of Visual Studio then you can also use ATL to simplify some of the work.
You won't be able to re-use your JavaScript code. Unless perhaps JavaScript code for manipulating the DOM of the currently loaded webpage.
This article is what got me started:
http://msdn.microsoft.com/en-us/library/bb776819.aspx
I found this to be a helpful sample.
I want to warn you though that creating an IE toolbar can be quite painful. If you are serious then I recommend that you learn and understand the basics of COM and ActiveX first. (I did not do this and spent many hours messing around getting nowhere.)
An alternative option would to embed XULRunner in IE. It would allow you to port most of your code. I have never tried this myself though.
Well the company www.softomate.com is focused on porting existing FF plugins to IE and other browsers. We were able to port my existing Security related plugin to IE and Safari with them.

Categories

Resources