Is there a replacement for browser plugin(maybe a driver?)? - driver

The reason I don't want to go the browser plugin way is that you need to implement it for various browsers.
Like xpi for firefox, browser helper object for IE.
My target platform is only windows, and I just want the alternative of browser plugin to call a client side programe after instructed when the user is browser the web page.
Is that viable?

The only "viable" solution would be to register a protocol handler system-wide so say addresses starting with "myprotocol://" trigger your app. Users will still need to install your program and your program will only have access to the parameters passed by that protocol handler, so you will have to evaluate on your own if it's worth it.
Also note that some browsers or settings might show a confirmation message before using your new protocol for the first time, so users should be informed on what to do (and warned that this prompt is part of the normal workings of your app).

Related

What does this steam-desktop shortcut URL steam:// mean

How do steam-desktop shortcuts steam:// actually work?
The URL / target of them is something like: "steam://rungameid/717"
I know similar things like "ftp://mynetworkadress:1337/subfoldercontainsgoodstuff" or for sure "http://".
But why and how does this steam thing work, can you do something similar on your own (e.g. "niceapp://launchprocess/param") and if so, why would you?
steam:// is the Steam browser protocol, i.e. a proprietary URL handler.
The official documentation is at Valve Software.
An article by PCWorld on the Steam URL protocol and potential security threats can be found here:
When the Steam client is installed on a system, it registers itself as a steam:// URL protocol handler. This means that every time a user clicks on a steam:// URL in a browser or a different application, the URL is passed to the Steam client for execution.
But why and how does this steam thing work, can you do something similar on your own
Yes. You can implement anything on your own.
The URI format is basically:
<protocol>:<arguments>
Some protocols such as http and ftp accept URL as argument. However the argument for any arbitrary protocol does not have to be a URL. For example, the magnet: protocol used by Bittorrent does not use a URL instead it describes the torrent and the torrent hash.
As you have experienced, browsers support some protocols built in. This includes http and ftp as well as custom protocols such as about:config in Firefox and chrome://settings in Google Chrome to display the settings page.
If a browser encounters a protocol that it does not understand it will ask you what program you want to open the link with. It will then tell the OS to run that program and pass the argument as a command-line argument to that program. This is how you can get the browser to open steam: link in Steam or a magnet: link in a torrent client.
It used to be that you can type any protocol in the browser's URL bar and trigger this behavior. However, modern browsers also use the same input as a search bar so typing in protocol:argument manually these days will more likely trigger a Google search. But links still work as they used to.

Launching Electron app from a standard web browser

Clicking a mailto: link will open my default mail client. In a similar manner, I would like to launch an Electron app with my-app:. What is the best way to achieve this and gracefully fallback to a standard http link if the app isn't installed?
Furthermore, I would also like to be able to pass through some extra details my-app:foo/bar. How would this be intercepted inside of Electron when it launches?
I have read some docs on what I think might be relevant stuff: http://electron.atom.io/docs/v0.36.0/api/protocol/ however as a frontend dev there's some gaps in my understanding of how the overarching process works. Any help much appreciated!
Electron has evolved quite a bit since this question was first posted.
You no longer have to dive quite as deep and can skip the Electron protocol API. Instead, use the app.setAsDefaultProtocolClient(protocol[, path, args]) interface and its siblings app.removeAsDefaultProtocolClient(protocol[, path, args]) and app.isDefaultProtocolClient(protocol[, path, args]).
These enable you to register a protocol identifier your-protocol:// and receive arguments:
The whole link, including protocol, will be passed to your application
as a parameter. Electron API docs
I'm not sure if it is possible to do what you want to do. Depending on whether you want to launch your Electron app from an actual browser window or simply from another Electron instance.
I found this other Stack Overflow post link that shows a workaround (though I'm afraid it won't graciously default to anything) and explains how it could be dangerous to launch programs directly from the browser.
If you want to launch your Electron app from another Electron app however you might want to check this out link.

Can we manage the silent print always by PHP or Jquery

print.print_always_silent use to print the page without print dialog box. My question is, can we do this my PHP / JQUERY code?. Please Help me how know well abt this.
I hope not. That would mean any website could print any document from my printer when they want. Would be a huge security hole imho
This is certainly not possible through the browser with PHP, which runs on the server. It's also not possible with javascript: browser security ensures that. Imagine what might happen if any web site could print whenever it wanted to.
There are (or were) ActiveX controls available for IE that enabled this. It might be possible with a browser extension for Chrome or Firefox if you want to explore that.
One other possibility is setting up a printer on Google Cloud Print and having your PHP server print directly to that, bypassing the browser altogether. Handling the authentication behind such a scheme could be tricky, but the API is documented on Google's site.

How to check if a Firefox addon is installed (on another computer)?

As part of my research on web usage, I have people install a Firefox addon to track their visits (kinda like RescueTime, but different for my research).
So I worry whether the users cheat by uninstalling the addon. Is there any way I can have the addon notify me on install/uninstall of the addon?
I know there's a bunch of workarounds for this (say, just by using another browser client). But what can I do for this very specific case?
PS - I have the same question for a Chrome extenion that does pretty much the same thing. I assume I should start another thread to ask that question.
You can register an observer for the em-action-requested topic: https://developer.mozilla.org/en/Observer_Notifications#Extension_Manager. This way you can get notified whenever the user chooses to uninstall your add-on. There is a number of limitations here:
Disabled add-ons don't get notified (they aren't active). You can get notified whenever the user chooses to disable your add-on however.
Most add-ons aren't uninstalled immediately, usually this requires a browser restart. Until that restart the user can still choose to revert his action.
Add-ons can be uninstalled while the browser isn't running, simply by removing the corresponding directory/file. No notification will be sent then.
It might be more reliable to send a regular "I am alive" signal to your server if you want to verify that the add-on is still installed.
For Firefox 4.0 and greater you can use the new AddonManager interface. Call the addAddonListener() method to pass in your listener. Implement the methods on your listener as documented, including onUninstalling() and/or onUninstalled().

How can I detect when user browses certain url?

I'm writing an application, which becomes "useful" once user is browsing certain url.
I want to add feature to my application, that it will be automatically launched once user browses this url, I was thinking of writing some sort of watchdog to trigger it.
My question is, whether there is a generic way to get notified when user browses to urls, I want to support at least IE and FireFox, chrome and safari is nice to have.
I read about DDE and WWW_RegisterURLEcho, but from what I understand it's not supported by FireFox, and also little sample I wrote didn't work with IE as well.
Thank you in advance
some more questions **
Do Url Monikers and Asynchronous Pluggable Protocols help me here ? Is it supported by FireFox ?
If you have control over the website, you could have it write a cookie to the computer. Then have your application monitor for that cookie.
You can implement this in many ways and at many different layers.
At the highest level, you could implement a browser plugin. There is no cross-browser solution at this layer that will let you write the code once and work for every browser. On the easy end of the spectrum, Firefox, you could implement it entirely as a Javascript + XUL plugin and use built-in XPCom interfaces (nsIProcess) for launching your helper process. For IE you would need to write a COM, C++ and win32 BHO that handles DWebBrowserEvents2::BeforeNavigate2. This is the hardest thing to do. There are mechanisms for Safari, Chrome and other webbrowsers that you could use to achieve this same behavior, with varying degrees of difficulty.
At the next level you could implement an HTTP proxy, similar to Fiddler2, that redirects all HTTP traffic through your local proxy first. Each browser has a different way of configuring its proxy settings, but they're all basically registry settings or config files.
At the most basic level you could just snif all IP traffic going out of the machine, similar to the way Wireshark does it, and just look for http requests to your URL. This is probably more difficult to code, but would work for all browsers without any special per-browser configuration stuff going on. You may need to write a driver. I dunno, I've never done work at this level in the stack.

Resources