Unable to load npapi helloworld plugin as extension in chrome browser - npapi

Downloaded the NPAPI hello-world plugin from https://github.com/axgle/npapi-chrome-plugin-helloworld and packaged it as a chrome extension (crx) using Chrome developer mode.
Loaded the above extension in chrome browser and tried to open test.html (provided with above plugin) in chrome browser. But it says "Could not load plugin"
Below is the source code of test.html
<doctype html>
<html>
<head>
<script>
window.onload = function(){
test = document.getElementById("pluginObj");
alert(test.sayHello());
}
</script>
</head>
<embed id="pluginObj" type="application/x-helloworld">
<body></body>
</html>
As per my validation, plugin is getting embedded (since on altering test it gives HTML document object) but unable to invoke sayHello method of the plugin.
However when I tried to load the above extension in another PC over there it loaded properly and was able to invoke sayHello method of the plugin.
Both systems have same OS (Windows XP + SP3) and both are using same version of chrome browser (23.0.1271.97 m)
Appreciate any help on this front.

When you added it to the CRX did you mark it public? If you don't it won't be visible outside of the extension.
See the relevant docs
Here is another relevant question: Google Chrome Extensions and NPAPI

Related

Autodesk Forge Viewer API: WebVR Extension does available?

I try add webVR Extension using viewer API.
There is no error on console, but the webVRicon is not displayed.
How to load webVR Extension.
It's My source code:
HTML:
<link rel="stylesheet" href="https://developer.api.autodesk.com/viewingservice/v1/viewers/style.min.css?v=2.13" type="text/css">
<script src="https://developer.api.autodesk.com/viewingservice/v1/viewers/viewer3D.js?v=2.13"></script>
JS:
var viewerElement = document.getElementById("viewerMain");
view = new Autodesk.Viewing.Private.GuiViewer3D(viewerElement, {});
view.loadExtension("Autodesk.Viewing.WebVR");
I'm using GoogleChrome/FF.
For a developer using Forge viewer, there is nothing more than just adding the following code to load the WebVR extension:
view.loadExtension("Autodesk.Viewing.WebVR");
Your code should be all good for the initial webvr experience, the reason why the WebVRIcon does not show is because the desktop Chrome does not support WebVR by default, you can check the WebVR extension script for the detail, or you can check this website [http://www.createwebvr.com][1] for all the supported browser.
I have deployed a website https://viewervr.herokuapp.com/ with WebVR extension enabled, you can open the link within your mobile phone to check how it works.

How to make a web page compatible with google chrome

I have include Html page into another html page in Dreamweaver using the below code
<script type="text/JavaScript">
$(function(){
$("#header").load("header.html"); });
</script>
but this code is not with Google chrome browser.
Please help me out how to make a web page compatible with Google chrome browser.
It seems that you open this page as local file. For security purpose Goodle Chrome doesnt allow to make AJAX call to local files. To solve this problem you can install the local webserver and open the page using http:// protocol instead of file://

Unable to enable Chrome app in iframe

I'm trying to load the native messaging example app in an external webpage as follows:
test.html
<html>
<head>
</head>
<body>
<iframe src="chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/main.html"</iframe>
</body>
</html>
I have added the web_accessible_resources property in the app's manifest:
manifest.json
{
// <some code snipped>
"web_accessible_resources": ["main.html"]
}
However, when I use the app within test.html, I get the following error in the console, coming from a JavaScript file within the app:
Developer Console
Uncaught TypeError: Object # has no method 'connectNative'
main.js:51
The problematic line of code is the following:
main.js
port = chrome.runtime.connectNative(hostName);
Here's a screenshot - the problem happens when I click on the Connect button (which calls the connect function):
Obviously, this works when the app is run standalone. How can I go about loading the app in a webpage?
You can't. With very few exceptions, Chrome avoids proprietary extensions to the open web. You're asking for exactly that: an external web page that has nonstandard abilities simply because it's opened in Chrome rather than another browser. As the web is today, that kind of behavior would lead to a poor developer and user experience. The native-messaging documentation suggests that the functionality you want is available to Chrome extensions and Chrome apps. And as you're finding out, that's indeed the case: it works as an app, but not as a web-standard iframe. This is by design.
You probably want to write a Chrome extension. Your webpage should detect whether the Chrome extension is installed and whether the user's browser is Chrome. If it's not Chrome, it should give an appropriate error message. If it is Chrome but the extension is not installed, it should urge the user to install your extension.

Chrome getUserMedia Not Requesting Permission Locally

I'm attempting to play around with navigator.getUserMedia in Chrome; however, it is not requesting permission when served locally (file:///whatever/index.html), but does on JSFiddle ( http://jsfiddle.net/EBsvq/ ) and other sites.
Does anyone know the reason for this? Do I need to somehow reset my permissions?
Here is what I am using locally:
<html>
<head></head>
<body>
<button id="btn">Start</button>
<script type="text/javascript">
/*! jQuery v1.8.3 jquery.com | jquery.org/license */
//JQuery goes here
</script>
<script type="text/javascript">
navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia;
$(function(){
$('#btn').click(function(){
navigator.getUserMedia({audio: true},
function(){
alert('success');
},
function (err) {
alert('fail: ' + JSON.stringify(err));
}); }); });
</script>
</body>
</html>
Chrome blocks a lot of stuff on file:/// URIs without reporting a security error (eg. Geolocation). Your best option is to run from a local webserver, if you have Python installed try SimpleHTTPServer.
You can use the --allow-file-access-from-files flag from the command line when opening chrome to be able to use getUserMedia from a local file system.
I encountered similar problem, but related to microphone access.
Chrome blocks device access if you serve your file via file://(note that on Microsoft Edge and Firefox it worked via file:://).
One solution i've found for Chrome:
open chrome an type in the URL chrome://version/
copy the value of "Command Line" field in your command line and append
--allow-file-access-from-files and run it
after Chrome opened and enter your file:// url.
For starting Chrome always like that, right click on Chrome icon, and then click on properties. In the Shortcut tab append to the Target value all the command line parameters from 2.
It's a little non-trivial how to do the command line arg in OS X. It will usually look like this
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --allow-file-access-from-files
If you are a freak like me, and put your apps in ~/Applications, then it will be
"/Users/yougohere/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --allow-file-access-from-files
If neither of those are working, then type chrome://version in your Chrome address bar, and it will tell you what "command line" invocation you should be using. Just add --allow-file-access-from-files to that.
Try Installing Simple Server ( light weight ) , one click install , can be downloaded here
Once it is installed , refer the app to the page you want to run.

Unable to use Chrome Experimental Devtools API

I'm trying to use the Chrome Experimental Devtools API.
I've tried running Chrome with: --enable-experimental-extension-apis as suggested here: http://developer.chrome.com/extensions/experimental.html and enabled the "Experimental Extension APIs" in the flags settings.
When I open the Console in Chrome (or Canary), I get the following:
chrome.devtools: undefined
chrome.experimental: undefined
I'm running Chrome 21.0.1180.77 beta-m. I've also tried Canary.
What am I missing?
As explained here: http://developer.chrome.com/extensions/devtools.html, the chrome.devtools APIs are only available in your devtools HTML page.
First, you need to create an HTML file and then add it to your extension's manifest under the "devtools_page" key. When you load your extension into Chrome and open the DevTools, you should see your new tab.
In that tab is the only place chrome.devtools will work.
chrome.experimental is different and will be available in all of your background pages and content scripts.
You need to run it only in Canary.
Plus when you run chrome add this flag to the command line:
path_to_chrome.exe --enable-experimental-extension-apis