Forum Moderators: open

Message Too Old, No Replies

Making a pop up window that isn't one

Can the onload help?

         

Macguru

3:30 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am more SEO than a designer but I definetly need a designer's trick to help me with this one!

I am working on another real estate site. I want visitors to see a commented slide show of the house in a smaller window that pop over the main one. I also want the SEs to find these pages.

Right now, I am using a regular HREF with target _blank on the main page. I use onLoad=window.resizeTo(340,450);window.moveTo(200,0) on the first pop up page and onLoad=window.resizeTo(340,450) on following slide show pages to allow visitors to move the window where they want it.

Can I use on page JS to remove adress bar, tool bar and the likes on loading?
I am better to use a NOSCRIPT tag and a regular pop up script from the main page?

Sinner_G

3:41 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mac, maybe a stupid question, but wouldn't it be easier if you used layers instead of a new window?

Macguru

3:45 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Text of main pages and slide show pages are already carefully crafted to get good results on various SEs. I can't mess it with layers. There is also the internal linkage issue, those slide show pages add thousands of pages to site...

[edited by: Macguru at 3:52 pm (utc) on Aug. 7, 2002]

jquerin

3:51 pm on Aug 7, 2002 (gmt 0)



I use this function that I found on builder.com from CNET, it's worked wonderfully for me everytime I've used it.

function openPopUpWindow() {

popupWin = window.open

('page.html', 'remote1', 'scrollbars,width=320,height=220,left=100,top=100')

}

The page.html is your page that you wish to fill the window with, the remote1 is the name of the window, the next set of options indicates what you wish to have in the window, and window properties. Scrollbars means you get scrollbars if necessary, the width is the width of the window, height is the height, left is the left position on screen and top is the top position. So this bit of code will create a 320x220 window located 100 pixels from the left, and 100 pixels from the top. If you look up the window object in a javascipt reference you can grab other window elements to be included.

If you want this page to load each time the page is loaded that will launch this pop window then use the onload function in the body to call the function name. And the function can be called whatever you want. Just place the above code in the head of the document, or in a js file that you link to the page.

--
Joe

ukgimp

3:53 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could you use java that would not be crawled but then create a logical static link also and use text like

New Window Version ¦ This Window

You have then given the user the choice whilst keeping the hard coded link and hence the navigation. Just a thought, it is possible that they may not have java enabled so you would not miss out on them either.

There is a popup java tutorial here

[idocs.com...]

Macguru

3:58 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi jquerin,

Welcome to WebmasterWorld.
Did you read paynt's welcome post [webmasterworld.com]? Nice way to get started here.

Thanks for the code for a regular pop up. Problem is Search Engines dont follow them.
I defenetly want this window to open on click, and I need the SE to follow the link.

>>Could you use java that would not be crawled but then create a logical static link also and use text like

Yes, with a NOSCRIPT tag. But I get a gut feeling some SE will not follow them. Page layout dont allow me to give them the choice. Plus, the choice is obvious. I dont want them to leave the main page when they visit the interior of the house.

What I need is onpage code to remove toolbar and the likes on the slide show pages.

[edited by: Macguru at 4:53 pm (utc) on Aug. 7, 2002]

jatar_k

4:01 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Mac, I don't think you can do it on page. I think you can only do it when the window is created. You may have to go with the pop up and noscript option.

Though keep in mind it wouldn't be the first time I was wrong.

moonbiter

4:12 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Can I use on page JS to remove adress bar, tool bar and the likes on loading?

You can remove everything but the title bar of the opened window. This is done for security reasons (so a window can't spoof a modal dialog). See the features of the window.open() method [msdn.microsoft.com] for details.

moonbiter

4:19 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Thanks for the code for a regular pop up. Problem is Search Engines dont follow them.
I defenetly want this window to open on click, and I need the SE to follow the link.

Here's the trick: You call the openPopUpWindow() function from the onclick event, but you also refer to the page you want in the href of the anchor tag. This way the SE have a link to follow, but you get your javascript functionality to boot. So you do something like:

<a href="fooboo.htm" onclick="openPopUpWindow('fooboo.htm');return false;">Link</a>

The return false is there to make sure that the main browser window doesn't follow the link after the onclick event.

You can get fancy and get rid of the uri reference in the function call by specifying this as an argument and then pulling out the href value of the anchor tag to feed to the window, but I won't get into any more code here. Sticky me for details if you need help.

Macguru

4:22 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Guys, read carefully, I know how to make a pop up window. The thing is, I try to avoid making one.

Thanks jatar_k, that is what I suspected. I will go by the book and use the NOSCRIPT tag. If some SE wont follow the link, I will give them a little help later. ;)

<added> Hey thanks moonbiter! I will try this one.</added>

Macguru

4:43 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Must have done something wrong here, the main window closes behind the pop up. I defently dont want this. I want the main window to remain open.

moonbiter

4:49 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



That I can't help with without seeing the code. There is no reason why it should do that if your scripting is correct.

Macguru

4:56 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, here is the code.

<a href="../visites/p/16_a.htm" onClick="openPopUpWindow('../visites/p/16_a.htm','','scrollbars=yes,resizable=yes');return false;"><img src="../images/generique/kodak.gif" width="26" height="53" border="0"></a>

What did I do wrong again? ;)

Sinner_G

4:56 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the main window closes behind the pop up

Does it close without an alarm? I thought that wans't possible?

<edit>
Moonbiter, please make sure to fix so it doesn't close the window here, I really would like to see this work.
</edit>

[edited by: Sinner_G at 5:02 pm (utc) on Aug. 7, 2002]

Macguru

4:58 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>Does it close without an alarm? I thought that wans't possible?

It depends on wich browser you use and how preferences are set.

moonbiter

5:05 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Well, I think the problem must be either in something you've added to the openPopUpWindow() function, or in the function that you are using in the linked page onload. The snippet you posted looks fine.

Macguru

5:13 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I will use a regular pop up script with the NOSCRIPT tag then.

joshie76

7:05 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm a bit baffled as to the use or purpose of the openPopUpWindow() function that just appears to be a straight wrapper for the JavaScript native window.open() method.<added>Just reread all the posts and it looks like there's been a bit of a mixup with the function parameters as the threads gone on.</added>

The following code worked fine for me on IE6, Opera6 and NN6 (haven't got nn4 at home, sorry).

<a href="../visites/p/16_a.htm" onClick="window.open('../visites/p/16_a.htm','','scrollbars=yes,resizable=yes');return false;" target="_blank"><img src="../images/generique/kodak.gif" width="26" height="53" border="0"></a>

With Javascript turned off a normal window should open (target="_blank").

Seems like your having a bit of a nightmare macguru! You have my assurance that the above code should be reliable though, I'm happy to look at a URL (sticky) if you're still having trouble.

moonbiter

8:05 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



I'm a bit baffled as to the use or purpose of the openPopUpWindow() function that just appears to be a straight wrapper for the JavaScript native window.open() method.

Personally, I'd use it to simplify the html markup. You can call the openPopUpWindow function with the this keyword(as in

<a href="fooboo.htm" onclick="openWindow(this);return false">Link</a>
, and drag the href url out of it to open the window, like so:

function openWindow(obj) {
var uri = obj.href;
var popupWin = window.open(uri,'newWindow');
}

That way, if he has a lot of links on the page he only has to change the hrefs and not the uri in the function arguments. You can also use it to get other useful things out of the element, like the value of the title, content-type, hrefLang attributes.

ergophobe

8:24 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To add to Moonbiter's comment, in a phrase: "functional abstraction". I realize that in an environment where people are counting bytes, they might not be willing to pay the price, but I think that sums up the reason for doing this. Once you've added the abstraction layer, you can use any methods you want to open the window and not have to change every URL as Moonbiter said.

That said, my solution to achieve functional abstraction is to create a PHP wrapper function that outputs the HTML tag. That way I can make the HTML as compact (or verbose) as I want, but still have the advantages of an abstraction layer. Of course you still pay a performance price but

1. in my case I don't actually care that much because the price isn't that big.

2. if you're paying someone $25-125/hour to build/maintain your site, you can buy a fair bit of hardware (remember, it's not a bandwidth issue, just a hardware issue) in the time it takes them to look through every line of code and modify every function call.

Tom

joshie76

9:00 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Personally, I'd use it to simplify the html markup. You can call the openPopUpWindow function...

Thats a great idea. I was working off the last usage of that particular function in the thread which was called with exactly the same parameters as those you hand to window.open. That had me a bit confused!

Don't forget to add the features needed (no menubar etc) to the window.open in the openWindow(obj) function.

mivox

9:08 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Must have done something wrong here, the main window closes behind the pop up. I defently dont want this. I want the main window to remain open.

Hmm... You might try adding a 'target="blank"' to the link code...
It's hard to explain, but I have a hunch that might work.

(heheh... apparently joshie76 had the same sort of hunch, and tested it, long before I got to it. Great minds think alike -- even if they don't always read threads thoroughly!)

Macguru

1:32 am on Aug 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks everyone! adding Joshie76's target="_blank" solved it. Nightmare terminated. ;)