How to create a browser plug in? - javascript

I have to create a plug-in that will have to display information when user hovers over certain terms. Can anyone show me the direction how to do it?
I do not have much ideas about creating plug-ins. I know what i want to do can be done by java script. But can a java script file be installed as a browser plug in? any ideas on this will be appreciated! Thanks!

What you want to do is create a userscript. It's exactly what you're describing: a piece of javascript code installed in the browser as a plugin.
Userscripts are supported:
By Firefox using Greasemonkey
By IE with its own version of Greasemonkey
Natively (soon) by Google Chrome
Natively by Opera
And even by Safari
So support is on almost every major browser.
A userscript is the easiest solution for what you're trying to do.

Kango's Content Scripts are similar to userscripts, with perhaps better support for all browsers, and the extension (and thus also the user script) can be installed with one click if self-hosted instead of installing Greasemonkey separately.

Related

Open HTML link with IE11 [duplicate]

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.

Detect browser type and version in AngularJS and display a message if is not supported

I need to detect the browser type and version from where a Angular app is being accessed. I know there are a few JS libraries out there but don't know which one to use.
The web app is supposed to be supported on the latest editions of Chrome, Safari, Firefox, and Internet Explorer.
I've found this answer but I don't know if is the right way to go, so any advice around this? How I can achieve this?
If browser not support JavaScript then you can not display that message using JavaScript you need to use
<noscript> Message that has to display </noscript>
and you can apply css to it
if support and you want to check version using ng-device-detector is not possible because it only detect device types, OS types and browser name not version. I found this article which may help. If you still wanna use ng-device-detector here is GitHub source and this is plunker.

What's a simple way in Google Chrome to insert Javascript into sites?

I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like:
Visit site See that sidebar overwrites content
Whip out developer tools, find div id for sidebar
Edit a snippet of javascript which is executed on document.ready for this domain:
$('#sidebar-right').remove();
A bit of searching for user scripts tells me that I need to be writing a Chrome extension, which seems unfortunate and overkill. Is there not an easier way, or an extension which is nothing but a javascript editor that assigns snippets to domains? I'd really like to be able to edit in Chrome itself, or at least have a file that I can just leave open in MacVim all the time. An extension requires unloading/installing to update as far as I can tell.
If I just had one big javascript file, that would be fine. I'd just wrap my customizations in domain checks.
Bonus love if I can write in CoffeeScript.
The answer is to use the Tampermonkey chrome extension.
https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo
Why not dotjs http://defunkt.io/dotjs/ ? It's local, you can version it with git, you can easily take it to another computer...
Another alternative that neatly solves the problem is Custom JavaScript for websites. You just need to install the extension, which takes around 2 seconds, and then you can immediately start typing your custom JavaScript for the specified website.
The extension automatically recognizes the current website, so all you need to do is write your code and click on Save. You can also easily import jQuery or your external scripts for convenience.
Custom JavaScript for Websites 2 is an alternative to Custom JavaScript for Websites, with some bug fixes and sync scripts across devices feature.
Snippets are available directly in Chrome Devtools
https://developers.google.com/web/tools/chrome-devtools/javascript/snippets
Witchcraft is another Google Chrome extension for loading custom Javascript and CSS, and it is supposedly for more avanced users. The older dotjs project repository lists Witchcraft as its successor.
What you're looking for is Greasemonkey. But wait, Greasemonkey is for Firefox only, right? Turns out, you can install Greasemonkey user-scripts as native Chrome add-ons. Just go to userscripts.org and hit the Install button on one of them, and Chrome will automatically convert it into a native add-on. Then, write your own and install it using Chrome.
Note: This only works in Chrome 4.0.

How to package JavaScript as a .NET Internet Explorer 9 Plugin?

How to .NET package JavaScript as an Interner Explorer 8/9 Plugin, with the JS to be included in all IE browser pages?
I have recently finished writing JavaScript code for a browser addon, which basically runs on page-load via a JS load event listener, and for given domains it then checks for certain elements in the DOM and adds new relevant elements(i.e. information) to the page.
Since the JavaScript only reads/affects the HTML DOM independently (and does not need any toolbar buttons or anything else) the JS purely needs adding to the browser's webpages.
I have packaged the code to work with Firefox and Chrome and those are both working well, and I can run the code for IE in 'bookmarklet' form without problems, but I would like to learn how to package JavaScript as an actual .NET .MSI addon/plugin that will install for the current Internet Explorer 8/9.
Does anyone know of a suitable guide or method I might refer to please? I have tried searching online for tutorials but most walkthroughs refer to writing the plugin body itself (usually in other languages) and are thus not regarding packing existing JS.
I hope someone might have the solution please?
Note: Someone packaged an old version for me as a MSI installer for Internet Explorer 7 a year ago, which installed into Program Files with a plugin.dll plugin.tlb and plugin.InstallState plus BandObjectLib.dll Interop.SHDocVw.dll and Microsoft.mshtml.dll if that is useful.
Edit: Does anyone else know of any other options please?
IE doesn't have a mechanism for this, there simply is no JavaScript based extension ecosystem (though there are other methods to create extensions) for those browsers, yet. IE8 won't be getting one, you can pretty much guarantee that, IE9...we'll see what happens.
The closest JavaScript option available to you would be bookmarklets, which have much more limited functionality...but it's what's available.
Check out http://www.add-in-express.com/programming-internet-explorer/ and http://www.add-in-express.com/programming-internet-explorer/deployment.php they sell a package for this. It will cost you 200 dollar, but will save you allot of time (atleast, It saved me allot of time :) ).
I found a tutorial to create a plugin that loads JS-Code
http://shout.setfive.com/2012/05/01/internet-explorer-extension-quick-start-and-skeleton/

Is greasemonkey a built-in extension of Google's Chrome?

I'm trying both greasemonkey and Google's Chrome extensions. And found that Chrome seems to be using the same API names as GM. (I seem to be having the same bug...)
Just wondering whether greasemonkey is already a Google Chrome extension?
Yes, I believe you can just add Greasemonkey scripts and Chrome installs them as an 'extension' like all the other native extensions.
Checkout this article:
http://lifehacker.com/5461675/chrome-4-supports-greasemonkey-userscripts-without-an-extension
Note, however that some scripts seem to be supported on GreaseMonkey for Firefox only and can be a little buggy in Chrome. I'm not sure of the exact differences in implementation.
Simon.
#Simon pretty much hit it, but I wanted to make sure that this point is super-clear.
Google Chrome supports Greasemonkey scripts natively, using the same API so as to make existing scripts compatible. There's no Greasemonkey extension required.
Yes, Chrome supports userscripts but not fully as Greasemonkey. For example check out this userscript
Docs Online Viewer: http://userscripts.org/scripts/show/127774
It works well with Greasemonkey (in Firefox) but not with Chrome natively. There are many Greasemonkey functions that Chrome does not support yet.
I copy and paste a post from GreaseMonkey:
There is no greasemonkey extension for google chrome. What actually happened is chromium (the project which google chrome is based) developed it's own extension system and one component of that extension mechanism (probably inspired heavily by greasemonkey in the first place) works in almost exactly the same way (an external javascript interacting with a page purely through it's DOM) as greasemonkey. The chromium system uses a completely different api but effectively does the same thing. This large overlap in purpose and functionality combined with the popularity of greasemonkey on firefox meant they decided to implement the greasemonkey api (the majority of it anyway) natively within chromium. From there they went one step further and had the browser automatically wrap any greasemonkey scripts inside a chromium extension automatically and effectively made greasemonkey scripts a first class citizen.

Categories