Forum Moderators: open
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?
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
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...]
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]
Can I use on page JS to remove adress bar, tool bar and the likes on loading?
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.
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>
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.
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.
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
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.
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!)