PDA

View Full Version : opening target blank with wierd code


killdragon
11-17-2004, 06:11 PM
how do i use this code but without it realoding the page everytime i use it?


<a href="#" onclick="window.open('http://www.my site dot com' target="_blank",'','toolbars=0,scrollbars,resiable,width=550,height=400,status=0')"> click here </a>

Juparis
11-17-2004, 09:20 PM
What do you mean? Do you mean retrieving it from your browser's cache?

Depending on your browser settings, it will always open up and reload the page. This deals with your browser configurations, and not the code itself.

raasqwaaan
11-17-2004, 10:03 PM
<a href="page.html" onclick="window.open(this.url, '_blank', 'resizable,width=550,height=400'); return false;">Page (opens in new window)</a>

killdragon
11-17-2004, 10:31 PM
the code works but the page isn't loading right and it says the page is missing, im opening a .swf file and befire(with the code in my first post) it worked fine but now its not...any ideas...???

Juparis
11-17-2004, 10:35 PM
If your previous code worked, just go back to that coding... I'm still confused as to what you're trying to accomplish.

A .swf file is Flash, correct? Usually, with flash files, you need to make a page with the flash file embedded into the page, so IE (or whichever browser) opens it according to your configurations. Normally (not always), when you link directly to a .swf file, the browser will ask which program to use to open it...

I hope that helps, but I might also be misunderstanding the situation...

killdragon
11-18-2004, 06:30 PM
when i open a swf file it embeds itself on the whole page, thats why i want it a certain hieght and width, but with the new code it wont work. my original problem was that the old code had a link to the page your already on, and the page it opens in the window, so it basically refreshes the page each time you click on of the lniks, which kills my bandwidth (im using a freeserver). so i wanted a code that didn't do that, the new code worked, but wouldn't open the swf
hope this helps...

raasqwaaan
11-18-2004, 08:18 PM
I couldn't say why the code I posted isn't working for you, but the particular part you want is the return false after the function call in the onclick attribute. What that does is prevent the browser from carrying out the default action of the link -- which is the follow the contents of the href tag, which is a #, which, on its own, will do nothing more than cause the page to reload. So your code would look something like this:

<a href="#" onclick="window.open( ... ); return false">Link</a>
Notice the return false?

killdragon
11-18-2004, 11:23 PM
ya that works perfect thanks a lot for your help.

raasqwaaan
11-20-2004, 02:07 PM
You're welcome.