The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Prevent File Save As

As far as I know there is no way to do this but my boss thinks otherwise. On the website http://profile.keralamatrimony.com/search/search.php if you search using that form you are not being able to save files on IE 7. It says "This web page may not be saved correctly. Would you like to save anyway?". Does anyone know of a reason IE 7 behaves that way? Is it something that the website admin is doing? I highly doubt it is since Firefox has no problems saving the page. I think what it is is that IE 7 is resubmitting the ajax (dont know) and getting a blank response from the server or something. Can anyone fill me in on more why this website behaves that way and also if there is indeed a way to stop file save as.

There is no way to do that. I haven't heard of this before, but it seems like a feature of IE7. It doesn't prevent any body from saving the page - It just warns that the page may not work entirely as intended, if you do so.

So you're trying to prevent a page from being saved? The simplest way to do this is like I said before using javascript to check the document URL. This wouldn't prevent it from being saved but would prevent most (but not all) users from being able to access that saved page.

For example:
onload use javascript to check the document URL. If it isn't your URL (meaning it's on the user's system) you can have javascript set the display of the page to "none". Most people here on sitepoint would be able to get around it but for the average joe the saved page would not work.

Well since the images have to be downloaded to the user's computer before the browser will display them, that is not possible. Of course you could use java or flash to display and protect the images (unless the user crops the images from a screenshot). That's why watermarks are used.

I got an idea for a program that will convert an image to a table. The table columns and rows would be 1px in size. The program would set the background color of the table cells to the color of the correlating pixel in the picture. I don't know how that would affect performance but it could work. Just something I've thought about.

Again though the user could take a screenshot and cut out the picture, so it's not flawless.

He is only worried about the average joe user who only knows to right click, save as, and maybe view source. I have taken care of right click and view source (yes I know you can get around it) but like I said an average joe user will not. Also only interested in blocking users with IE from downloading this.

When I said every other way I meant every other way that my boss wanted. Haha sorry.

I'd have thought that most people wanting a copy of the page would use the "Save As" option in the "File" menu in the menu bar (and that can't be blocked).

Also anyone wanting to use right click to save things will have turned off the ability of web pages to disable it. Disabling right click only interferes with those people who use that menu to navigate between web pages and have the menu and toolbar at the top of their browser turned off. Disabling their only way of operating their browser and forcing them to close and reopen their browser in order to get around your block will get them extremely annoyed and have them telling everyone what a horrible site it is for not allowing them to leave.

I'd have thought that most people wanting a copy of the page would use the "Save As" option in the "File" menu in the menu bar (and that can't be blocked).

The website I have listed above somehow had success in blocking it (either by error of the site's programmer or something else) in IE 7. My boss wants me to replicate the error or code and I have no idea how they did it. I know of what you say about the numerous ways you can get around it but I posted here to see if anyone can figure out a way to replicate that site. If you try to save as on that site after you have searched for a user it initially lets you and then IE says cannot be saved and errors out. The error does not exist in Firefox. Like I said he is only interested in blocking people using IE.

I fully know and have told him AND have shown him all of the ways you can get around it but he wants our website to have the error or code that is causing IE 7 to error out on their website.

I can save that page fine using IE7. Whatever is stopping it from saving for your boss must be something in the way his browser is configured.

Thats really odd if thats the case. 3 computers in our office using IE 7 cannot save it. Let me try going home and seeing if I can save it there. I know forsure there is no custom configuration that I have set for IE 7 on this computer I am using. Are you saving the page as web page complete where it downloads the pictures too?