Protect img for google - html

If I create a folder on the server with pictures, I would like to load them ONLY for users with the correct password.
in short:
the user enters the password and then we use Ajax to load the image as img src syntax into the HTML file.
I realize that the direct image call is also possible without a password. However, the pictures are in very unusual folder paths.
what I'm interested in:
if Google or any other search engine crawls / indexes my page, will these images also be inserted and could appear in Google Image Search?
reply

In general, search engines will only crawl your HTML page and links inside it, not the actual folder structure and files of your server. It actually shouldn't even have access to your server files :)
If your images are not linked in the page, you should be fine.
That said, you can always use a robots.txt. From the official documentation:
A robots.txt file tells search engine crawlers which pages or files the crawler can or can't request from your site.
Use robots.txt to manage crawl traffic, and also to prevent image, video, and audio files from appearing in Google search results.
Link: https://support.google.com/webmasters/answer/6062608?hl=en

Related

How to load images from a network drive into HTML on a Coldfusion Server?

I need to load images from a secured network drive into an HTML document. I understand that because the network drive is not part of the webroot, this is not an option and is considered a security feature to protect the files that live on the network drive and server.
I have done some research and found these solutions:
https://stackoverflow.com/a/46003218/16511184
https://www.tek-tips.com/viewthread.cfm?qid=935379
These solutions both mention the use of server-side code to access images, as the server should have permission to access files on the network drive. My question is, how do I deliver the images to the HTML document, and in ColdFusion?
My naiive guess was to just grab the image name from a query made on the server, but just slotting the name into the img tag's src attribute creates the original issue of client trying to access an image on the network drive they don't have permission to view.
Using a virtual directory to reference images on a network drive technically works, but then any images in the "folder" will be publically available to the website. Instead, you need to use <cfcontent> to read the images from the network drive and present them to the browser.
In the HTML, you'll use a CFM as the source for an image tag:
<img src="/path/to/image.cfm?imageID=1234">
You'll reference the image file by an ID and NOT by a file name. Using a file name would still allow anyone to poke around and try to load files at random. You never give the path of the file on the server via the query string.
In image.cfm, you'll load the image file's path and use <cfcontent> to deliver the file. https://cfdocs.org/cfcontent
<cfcontent type="image/jpeg" file="//path/to/network/image.jpg">
You should also validate that the user has the correct role and permission to view the image in question.

Serving local file:/// links and AppCache

I'm making a webapp for members of my caving club to search through and view cave survey note PDFs. It works fine, and I got the AppCache working for the web version of it.
However, since the PDFs are quite large and slow to download, and many members have the PDFs on their local machines from the same SVN the website gets them from, it would be ideal for them to be able to use a page with links to a local SVN folder of their choosing.
The design goals:
The site displays links to PDF files on the local filesystem
Whenever I add features to the site, users get them automatically the next time they open the page and they're connected to the internet
But after the first time they open the page, the site works offline.
Sadly web browsers don't appear to support this useful combination of design goals at once.
I can satisfy #1 by having users download a copy of the site, add their local SVN path in a JS, and open their local copy in the browser, so that file:/// links work.
I can satisfy #2 by having absolute links to JS bundles on the server.
I can satisfy #3 by using the AppCache.
I thought I could get clever by having the copy of the page on the local file system have <html manifest="https://myserver.com/myapp.appcache">, but unfortunately Chrome doesn't seem to allow a local file to use an app cache manifest hosted on a server, for seemingly no good reason to me.
Does anyone know of another way I could satisfy all 3 goals?
Perhaps there's some simple program/config I could give my friends that would intercept web requests to https://myserver.com/some/folder and instead serve them out of a folder on their local file system?
Andy,
I know this post is a bit old but came across it looking for something else related to AppCache. My understanding it that the html page and the manifest must reside in the same domain for it to work. So I think you need to modify your design:
Create a JavaScript function that acts as a setting for the user to enter the path to their local copy of the PDF's. Store this information in localstorage.
Create a html template page for the document links.
Create a JavaScript function that populates the html template page with any documents and links the user enters.
This way, the users visit your application online and it uses appcache to store itself and the JS files for offline use. To access the PDF's, the user clicks a settings button that launches a page to collect path information and saves the information in localstorage. The users can then access the template page which will populate with the documents they entered.
Here is a good intro to localstorage: [http://www.smashingmagazine.com/2010/10/local-storage-and-how-to-use-it/]

Finding the list of all subdirectories in a link

Is there any way that I can find all subdirectories for one link? Should I get the permission? For example, in the lecture instructor opened the solutions by entering some keywords after www.site.com/keyword. Now I cannot remember the word, whatever I try, I cannot find, but I know there is a file. That's why I want to see the files, other pages for the link.
The only way to find out what resources are available on an HTTP server is to request a resource that tells you. There isn't anything particularly standard about web servers that will provide that, so you'll need to do something specific to the webserver you want the details from.
Note that not all servers will provide something like this.
The closest thing to a standard is that most servers, for a URL that maps on to a directory on their file system, if there isn't an index file in that directory, will generate an HTML document containing a list of links to the resources in that directory.

How to write Files from a HTML File in a DropBox

My knowledge about Web technologies is very low and I just wanted to know if the following scenario would be possible with HTML5 and Javascript:
If I host an HTML file in Dropbox and send this link to seomeone, would it be possible that this HTML file creates a new file in my Dropbox? For exampe the HTML file is a form that one can fill out, can the HTML file create a text (.txt) file with the form content?
As far as I understand, the HTML file has to be hosted by a webserver and has to allow Javascript or PHP to achieve this. But maybe there is a way to just use an HTML file, a dropbox and a browser?
Any hints what topics I should study to achieve this goal?
On what I've understood from Dropbox, it does not directly show you the file contents in any manner. You can store files there, but the only thing you can see when opening a link that directs to the file, is the page which allows you to download the file to your own PC and save it.
This would seem like an impossible thing to achieve, in any cloud service like Dropbox it would seem. I would recommend you to just get the web hosting service, they are usually not that highly priced after all.
You could do this, but you shouldn't. To make this work, you'd have to use the Dropbox API to upload files, and you'd have to embed in your web page an access token for your account. That means anyone who looked at the source of your web page could get access to make changes in your account (e.g. delete all your files). So there's no safe way to do this without a server-side component (like PHP).

How do I create a link to a saved html page on my computer?

I'm working on a web application that caches html pages and saves it on the user's computer. I want to create a link, so that the user can click on the link and access the cached webpage.
Following is my link to a cached page:
BBC
When I click on the link, nothing happens. I'm not even getting any error.
Can someone please suggest how to create a link to a cached html page?
First of all, not all browsers handle local files equally, indeed, not all computers will be running windows or have a C: drive. Secondly, you don't have much control over a user's cache. Cached pages are usually handled by the browser automatically. You can use headers to specify how a browser ought to cache files, but it's not even required to do so. You can read the W3C recs on caching for more information.
It's unclear what you're trying to do here, but it sounds like it might make more sense for you to use HTML5 local storage or offline files than trying to mess around with their file system directly. The security model of most browsers is such that web apps don't interact with local files, which may be why it's not working for you with your current setup. Dive Into HTML5 has a good overview of HTML5 local storage and offline pages.
Edited based on comment below:
Most browsers' security settings won't let a page on a website access files stored locally. Only locally saved files can link to other locally saved files. Therefore, if the page with a link is on a website, your link won't work. Try creating a link to your file from another locally stored file and see if that works.
Instead of providing the .html extension in the main page where you provide the link you should do something as below:
< href="file:///C:/Users/xxx/yyy/bbc">BBC</a>