Click to See Complete Forum and Search --> : window.open help!


Taneya
01-06-2003, 06:10 PM
Hi everyone,

I am an absolute newbie with Javascript, but I've been playing around with this for the past couple of days and cannot figure this out.

Can someone help me? How do I code an a href tag that will open up a window that contains an image and the location (URL) of that image does not show. The location is the only feature I care about controlling.

So, if this is the image:
http://www.taneya-kalonji.com/pics/misc/teddy_wizard.jpg

what should my a href tag look like? I would also prefer it to stand-alone so I do not want to put any Javascript code anywhere else in the page.

Is this possible? Would someone be nice enough to provide me with an example?

Thanks in advance!

ChikoritaPro
01-06-2003, 06:42 PM
If you want the location of a new pop-up window to go POOF, all you have to do is this :):

<!-- Note that you do not put anything in the href. -->
<a href="" onClick="window.open('locationofthepicture.jpg','nameofthepopup',config='width=150,height=150,location=0')">Link that you wanted to be clicked on.</a>

Note that that should all be in one line.

Note that you do not need to have the width and height to equal to 150. Those are just the size coordinates of the new window. location=0 means that there will be no location bar shown in the new window. Also note another thing: Please DO NOT put any double quotes inside the double quotes; instead, put single quotes in there, or else, they would be wrong! You should figure out where to put the location of the picture and the name of the picture in the window just by looking at it. Well, enjoy :)!

Taneya
01-07-2003, 03:01 PM
Thanks for the reply! Using the code you gave me I was able to get it to work! However, it didn't work exactly like I thought it would. I don't think I was clear in what I wanted..

When i use the code above two things happen that I do not wish to happen:

1) the URL still shows up in the titlebar area. True, there is no location bar, but I don't want the user to see the URL of the image. How do i prevent that?

2) When I click on the link that opens up this window, the page that the link is coded on returns to the page before it. So, the user would then lose the page they were on that got them to the link in the first place. I have the code in a database and am calling it up with a PHP script. Does this make a difference? I would like for the original table to still remain...

Any more suggestions?

ChikoritaPro
01-08-2003, 04:06 PM
Sorry I was late; I was quite busy. Anyways, for what you're asking, to get rid of the Location in both the location bar and title, you need to create an entirely new webpage for the picture. Another problem, when we create a webpage, the Location will be shown in the Source. Even another problem, we can't write any coding in a picture pop-up page. The last problem is that you do not want any JavaScript tags to be written, so that would make things pretty darn messy. So many problems at once...

Anyways, the best I can do is this:

<script language="JavaScript">
<!--
/*
Place this entire JavaScript between the <head> and </head> tags.
*/

function popthepicture()
{
picturepopup=window.open('','nameofthepopup','width=150,height=150
,location=0')
picturepopup.document.title="Title to block Location Name"
picturepopup.document.write("<img src=picture.jpg>")
// Note that window.open() command is all in one line.
}
//-->
</script>

<!-- Now place the rest of this between the <body> and </body> tags. -->

<a name=nameofthislocationofthepage>
<a href="nameofthispage.htm#nameofthislocationofthepage" onClick="popthepicture()">


That's the best I can do. Anyways, sorry to say this, but it's flat out impossible to hide your picture location. There's always a way. Even copying and pasting is deadly to the images. The only way to avoid any images stolen is to not place them on at all, unfortunately.

Anyways, I hope you enjoy the script, and hope you figure out your problem soon :)!

Taneya
01-08-2003, 10:15 PM
thanks for the reply. I won't have a chance to play around with this until the weekend, but I do appreciate all the information you've given so far. I completely understand all that you've said about protecting images! I've been pondering this problem for weeks now. Oh well! :) I'm not too overly concerned about it though - I'll deal with it. Again, thanks!