Thread: Opening a new window
Results 1 to 13 of 13
Related
-
Verifing Window 'size' upon Opening a File. Forum: Javascript Forum
Replies: 8 -
Opening New Window Forum: Javascript Forum
Replies: 9 -
javascript-help with opening in frame window Forum: Javascript Forum
Replies: 1 -
Page opening in new window - Help Forum: HTML Forum
Replies: 7 -
problem with javascript opening a new window Forum: Javascript Forum
Replies: 4
-
04-16-2009, 04:32 PM #1
Opening a new window
Hello - I am a newbie to the forum needing assistance with some HTML coding.
I am trying to create a page which has a number of small images acting as buttons. When an image is clicked, a new window is opened which displays that image in full size. I would like this page to contain a "Close Page" button which closes this page. Also, is there HTML code which prevents users from downloading images that appear in this new window?
I have found javascript code which closes a browser window:
<a href="javascript:window.close()">
<img border="0" src="closingwindows.gif" width="50" height="20">
</a>
but where do you put this code, given that the new page to display the full size image is created from the page that contains the thumbnail of that image?
Any help appreciated!
Onesimus
-
04-17-2009, 11:06 AM #2
Re: Opening a new window
From what I see, you have two questions. I will do my best to answer them.
First:
I recommend switching to Lightbox for viewing your images larger. It is EXTREMELY simple to use and implement, and creates a very clean and professional look. You can download it at http://www.huddletogether.com/projects/lightbox2/#download
Second:
There is javascript that disables right-clicking on a page, but that is typically frowned on for any sort of security for the following reasons:
- If javascript is disabled, the user can still right-click and save the image.
- Anything that is visually seen in a browser window is already downloaded via the internet cache.
If you are wanting to secure your images, place a watermark on them instead. That way, there is a visual reminder of who owns the image. This is a pretty simple thing to do, and there is a myriad of tutorials on how to do it using everything from MS Paint to Gimp (a free program on par with Adobe Photoshop).Last edited by HTML; 03-08-2012 at 04:45 PM.
-
04-18-2009, 01:31 AM #3
Re: Opening a new window
How can you use this javascript on your site?
-
04-19-2009, 02:13 AM #4
Re: Opening a new window - solution
Hello All!
Thanks to all who replied! I have found a solution.
Here is the HTML coding for the page which contains the (thumbnail) images. In this example, there are 2 images.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Main Gallery</title>
<script>
function openWindow1()
{
window.open("Lorikeet1.html","Lorikeet 1","width=600,height=800,resizable=0");
}
function openWindow2()
{
window.open("Lorikeet2.html","Lorikeet 2","width=600,height=800,resizable=0");
}
</script>
</head>
<body>
<table width="22%" border="1" align="center">
<tr>
<td width="28%"><a href="javascript: openWindow1()"><img src="Lorikeet1S.jpg" width="124" height="175"></a></td>
<td width="72%"><div align="center">Rainbow Lorikeet </div></td>
</tr>
<tr>
<td width="28%"><a href="javascript: openWindow2()"><img src="Lorikeet2S.jpg" width="124" height="175"></a></td>
<td width="72%"><div align="center">Rainbow Lorikeet</div></td>
</tr>
</table>
</body>
</html>
Note that there is a javascript script for each image. I could not find a script which would deal with all images. Can anyone help here?
Next is the HTML code for a page which contains the enlarged image: This page would be repeated for each image:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<script>
function closeWindow()
{
// Close the current window
window.close();
}
</script>
</head>
<body>
<div align="center">
<p>Rainbow Lorikeet
<p><img src="Lorikeet1M.jpg" width="496" height="702">
<p><a href="javascript: closeWindow()">Close This Window</a>
</div>
</body>
</html>
The HTML coding that I use does overcome one problem - the inability of close.window to work in Firefox . To date, the solution works in both Safari and Firefox
Help this helps!
Onesimus
-
04-20-2009, 12:14 AM #5
Re: Opening a new window
Since my last email, I have gone back and checked jthayne's suggestion to use Lightbox. Yes - he is right! It is simple to use and very elegant in its operation. Highly recommended! Thanks jthayne!
As a Mac user, I have found that ImageWell does a great job of creating watermarks on images.
Onesimus
-
04-21-2009, 09:23 AM #6
Re: Opening a new window
-
04-21-2009, 10:17 AM #7
Re: Opening a new window
Hey Onesimus, you are not a newbie. You are very good at making websites. You got talent. Welcome to the forums!
-
04-21-2009, 04:44 PM #8
Re: Opening a new window
Thanks adamsen.
Yes, making websites is a hobby that I have been practising for years. At the moment, I am the website creator and updater of two church websites, one of which is:
http://www.parish.woll.catholic.org.au/home/rmeadow/
The other website is pretty much the same as this one.
At the moment, I am in the process of creating a website to sell my photography - hence my request. Very fortunately, the responses to my request "Opening A New Window" have brought in some fantastic answers and I am modifying the design in response to these answers. The only problem at the moment is that the website works perfectly in Safari but not in Firefox! There's no Mac version of Explorer.
Best wishes!
Onesimus
-
04-21-2009, 05:39 PM #9
Re: Opening a new window
-
04-21-2009, 10:13 PM #10
Re: Opening a new window
Hi jthayne - once Apple released the Safari browser, Microsoft ceased further development of Explorer for Mac. (Mac users have Microsoft Office - but no Outlook and Publisher). I believe the last IE for Mac was Version 5. It may still run under Mac OS 10.5 (Leopard), but I haven't tested it. The funny thing is that Safari now has a Windows version for XP and Vista. As I also run Windows XP on my Mac, I can test my websites using current Windows versions of Firefox, Safari and IE7.
Onesimus
-
04-22-2009, 09:02 AM #11
Re: Opening a new window
Awesome. Thanks for the update on that.
-
04-23-2009, 12:10 PM #12
Re: Opening a new window
Hi Onesimus
I will wish you the best luck with your projects.
Adamsen
-
04-28-2009, 09:19 AM #13
Re: Opening a new window
Hello Onesimus. Just a little tip. Since you are already creating a separate page for each larger picture (rather then just pointing to the xxx.jpg file directly) you could simply create an HTML template and reuse it for each photo editing the photo file name and HTML file name accordingly. This would have the "Close" or "Return" or "Home" button in it and it would point to where you need. Simple HTML and no more problem with IE, FF, Safari, or any others.