Sending messages from file system html page to a chrome extension - google-chrome

I'm new to creating chrome extensions. I want to test sending messages from a web page to an extension as described here: https://developer.chrome.com/extensions/messaging#external-webpage.
I'd like to just use an html file in my file system, like "file:///C:/Users/johng/Documents/TestExtensionCall.html", to do the initial testing but the developer documentation indicates that you need to include "externally_connectable" in your extension manifest to expose the messaging api and the url pattern must include a second-level domain.
Can an html file from the file system be used to test sending messages from a web page to a chrome extension? Do I actually need to use a web page from a web site to do the testing?
Thanks,
John

For testing externally_connectable, you have1 to use a web server.
Though, you can still use a local development web server. Normally, it would have a localhost hostname, but you can specify an alias for it in your DNS hosts file, say, my.localhost, and it would satisfy Chrome's requirements.
See here for more information about the hosts file.
1 To the best of my knowledge

Related

Angular 2 app - link to local file

In my app I'm viewing a list of files on the local machine (their paths are fetched from DB). When a file is being clicked, it should be opened. I tried the following with no success:
FileName
When the user clicks the link above, nothing happens. When using chrome, I can see the following error message in the console (on firefox there's no message):
not allowed to load local resource
I have read this question, and understood that:
Mozilla browsers refuse to follow file URLs on a page that it has fetched with the HTTP protocol.
I also understood and that this feature was implemented in other browsers as well.
The presented files are not located in the server, but on the local machine. So I can't use a relative link (right?). Is there anyway to bypass this and create a link that opens a local file?
You cannot access local resources from a website served over http because it is a security concern. Think of what would happen to your machine if any website could access files on it. You'll have other security restrictions for serving data from a different domain from your domain as well.
What exactly are you trying to accomplish by accessing a local file? Giving additional insight into the reason might get you more useful suggestions. Otherwise, the answer is that you can't and shouldn't do this.

Eddystone for internal URLs

I programmed a service for the teachers of a school a tool which they can use to automate their classroom.
For easier access, i want to implement authentication via URL. The teacher WLAN is on a seperate subnet than the others.
The URL is a subdomain of a domain I own and added a SSL certificate. Now I am ready to deploy some beacons for test purposes and I noticed that Google Chrome won't show the beacons with my internal URL. URLs like google.com and facebook.com work just fine.
The physical Web browser app recognizes the internal URL.
What should I do?
Unfortunately, you cannot use Chrome to display physical web URLs pointing to a private subnet. Part of the Chrome system is a server-side component hosted at Google that checks the URL, validates that it resolves, and pulls metadata about the page it points to. If the page is not accessible on the open Internet, this check will fail and Chrome will silently ignore the physical web URL transmitted by the beacon.
While you cannot use Chrome to display such URLs, you can display them in your own custom app using detection SDKs like the Android Beacon Library.

How to prevent Google Chrome from blocking my installer package

I've prepared and published on my website an installer package with the software I developed. The package is compiled and bundled into .exe file using WiX toolset and contains no viruses or malware. Next when I try to download the file I get a notification from Chrome that it's blocked due to malicious content.
Malicious content warning
I'm really upset that my customers being misinformed with such warning. Any ideas how to get around it?
Google created this page for developers - https://support.google.com/webmasters/answer/3258249.
Even though it doesn't say it on there, almost all auto-detection software will not block software that is digitally signed (and there is no bad reputation associated with the signing certificate).
If it's a simple file, just upload it to Google Drive or DropBox, and generate a public link for it and then share it on your website.
You can also shorten that link, if your application provide this service, or via goo.gl, in order to view clicks' count.
If any developer come across this issue, I manage to resolve it by streaming the downloadable file instead, via different URL (which doesn't have the file name and its extension with file's full path on your hosting).
Doing so by manipulating the response header, will fix the issue.
Here is a useful link about streaming a downloadable via php script

google drive hosting changes in URL

I've developed a web app that uses google drive as hosting platform as explained here:
https://support.google.com/drive/answer/2881970?hl=en
The application has been working OK when users accessed:
https://googledrive.com/host/0B0YWdwxH6K5XdVpaNjhWUl9vZkE/?scriptid=AKfycbx66sZMaqLK8byhV7wY_DoQ8ouqF1acWRcc0JIHyDu5CVWZupAK&id=people
But yesterday it started redirecting that address to:
b216bdb4cf56e8d9d85cf1123921ca125a010325.googledrive.com/host/0B0YWdwxH6K5XdVpaNjhWUl9vZkE/
any idea why? is this a permanent change? does the subdomain key follow any logic?
Browser: occurs on chrome & IE
Operating System: windows8
Drive on the Web / Drive for desktop: when accessing googledrive.com/host
I found the right thread at google.com to answer this. Here it is: https://productforums.google.com/forum/#!category-topic/drive/mTyJXruRhBg
In short, the redirect and prefix is here to stay. It's for some security thing. All files within the same googledrive folder will be prefixed with the same guid-looking string. That is, provided we use this googledrive url form: googledrive.com/host/{folderID}/FriendlyFilename. Then, any support files you want to access or link from that folder, just access them as FriendlyFilename with relative url form.
My problem was, I was using the obscure form googledrive.com/host/{userID+fileID}. (no FolderID or FriendlyFilename). That now gets a different domain prefix for every file within the same folder.
Here's a different variation of that test file I showed above (which was getting Security exception for webworker). It works now by using the {FolderID}/FriendlyFilename form. Tada. https://googledrive.com/host/0B8BLd2qPPV7XME1rNU9iWnYtbTg/ded-worker-F12throw.html

Given URL is not allowed by the Application configuration. when using the Facebook Javascript SDK

Im currently using the Facebook Javascript SDK and I keep running into the following problem that appears in the console:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I've read a truck load of related posts but still can't get it to work. I am working locally using the following: http://localhost:8080/bookbayapp/. In my facebook developers app section I have the following:
But once again nothing seems to work. I am currently using Google Chrome for the testing and it is worth to mention that I am using the Facebook Plugin for Phonegap but when testing I comment out the link the to plugin js so I assume in doing this there shouldn't be any problems?
What works for me is using the actual URL of the production server, and then adding a line to the hosts file that redirects all traffic from that URL to localhost.
Let's say your website is called potatoes.com. In "Site URL" write:
http://potatoes.com/bookbayapp
and then open your hosts file (C:\Windows\System32\drivers\etc\hosts) and add the following line:
potatoes.com 127.0.0.1