37 users online (0 members and 37 guests)  


  Results 1 to 13 of 13

Related

  1. Verifing Window 'size' upon Opening a File.    Forum: Javascript Forum
    Replies: 8
  2. Opening New Window    Forum: Javascript Forum
    Replies: 9
  3. javascript-help with opening in frame window    Forum: Javascript Forum
    Replies: 1
  4. Page opening in new window - Help    Forum: HTML Forum
    Replies: 7
  5. problem with javascript opening a new window    Forum: Javascript Forum
    Replies: 4
  1. #1
    Onesimus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    Sydney - Australia
    Posts
    5

    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

  2. #2
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: Opening a new window

    From what I see, you have two questions. I will do my best to answer them.

    First:
    Quote Originally Posted by Onesimus View Post
    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.
    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:
    Quote Originally Posted by Onesimus View Post
    Also, is there HTML code which prevents users from downloading images that appear in this new window?
    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:
    1. If javascript is disabled, the user can still right-click and save the image.
    2. 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.

  3. #3
    jessicasamuel's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Posts
    4

    Re: Opening a new window

    How can you use this javascript on your site?

  4. #4
    Onesimus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    Sydney - Australia
    Posts
    5

    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

  5. #5
    Onesimus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    Sydney - Australia
    Posts
    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

  6. #6
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: Opening a new window

    Quote Originally Posted by Onesimus View Post
    As a Mac user, I have found that ImageWell does a great job of creating watermarks on images.
    Thank you for the information. I have not been able to afford a Mac yet, so I am unaware of what is out there for Macs. This is good to know.

  7. #7
    adamsen's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Denmark
    Posts
    128

    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!

  8. #8
    Onesimus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    Sydney - Australia
    Posts
    5

    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

  9. #9
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: Opening a new window

    Quote Originally Posted by Onesimus View Post
    There's no Mac version of Explorer.
    There used to be. Did they stop supporting it?

  10. #10
    Onesimus's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2009
    Location
    Sydney - Australia
    Posts
    5

    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

  11. #11
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: Opening a new window

    Awesome. Thanks for the update on that.

  12. #12
    adamsen's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Denmark
    Posts
    128

    Re: Opening a new window

    Hi Onesimus

    I will wish you the best luck with your projects.

    Adamsen

  13. #13
    bassman's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2007
    Posts
    16

    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.



Tags for this Thread