Forum Moderators: open

Message Too Old, No Replies

open new window question

page title obstacle

         

hessfirm

1:47 pm on Mar 23, 2006 (gmt 0)

10+ Year Member



We have a customer linking to our site. They link by opening a new window using the following javascript:

{
newwindow=window.open(url,'name','height=500,width=600,resizable=yes,scrollbars=yes, menubar=yes');
if (window.focus) {newwindow.focus()}
}

then

<td class="vtCell"><a href="javascript:openWindow(http://www.example.com/Homelife/inventory.asp?subd=Ashley Place&cnty=Douglas&county=Douglas&subdivision=Ashley Place&lb=Hlcm01&source=GAMLS');">View
Available Homes</a></td>

My question is...even though i have given our page they link to a different page title, it shows our url in the top blue bar instead of the actual page title.

Any idea why or how we can change that?

Thanks!

[edited by: encyclo at 1:51 pm (utc) on Mar. 23, 2006]
[edit reason] examplified [/edit]

le_gber

9:01 am on Mar 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi hessfirm and Welcome to WebmasterWorld,! [webmasterworld.com]

could you show us the code from the <head> tag of your destination page?

jt007superman

4:43 am on Mar 27, 2006 (gmt 0)

10+ Year Member



Using IE? Test this.
Disable the address bar (View -> Toolbars ->Address Bar (unchecked)). You should see that every page you visit shows the url in the title spot, followed by the title specified by the <title> tag. The default behavior of the window object in JavaScript does not enable the Address Bar, so there may be a way to enable it if thats the problem.

I'll check it out and get back with you.

jt007superman

5:14 am on Mar 27, 2006 (gmt 0)

10+ Year Member



"newwindow=window.open(url,'name','height=500,width=600,resizable=yes,scrollbars=yes, menubar=yes');"

They would just have to add the following line to this JavaScript code to enable the address bar.

location=yes

It would look like this:
newwindow=window.open(url,'name','location=yes,height=500,width=600,resizable=yes,scrollbars=yes, menubar=yes');

adb64

9:09 am on Mar 27, 2006 (gmt 0)

10+ Year Member



I've also tried to do this some time ago and couldn't make it happen, see [webmasterworld.com...]

hessfirm

4:09 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



Thanks! Will give this a try and let you know.

rocknbil

6:11 pm on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hessfirm, why do you need Javascript? If you're sending someone to an external link and it's a listing, people will be annoyed by the inability to move around. Furthermore, if Javascript is disabled they WILL NOT SEE YOUR CONTENT.

I work with JS all the time and this seems like a better solution that both solves your problems and is better for the end user:

<a href="example.com" target="new window">New win</a>

But the JS coder in me cannot ignore some things, sorry, they stray from the topic:


newwindow=window.open(url,'name','height=500,width=600,resizable=yes,scrollbars=yes, menubar=yes');
if (window.focus) {newwindow.focus()}
....
<td class="vtCell"><a href="javascript:openWindow(http://www.example.com/Homelife/inventory.asp?subd=Ashley Place&cnty=Douglas&county=Douglas&subdivision=Ashley Place&lb=Hlcm01&source=GAMLS');">View
Available Homes</a></td>

1. The WINDOW NAME attribute needs to be unique. If you always name it "name" all the links will open in that SAME window. So if someone clicks a link, leaves it open, clicks back in the main window, and clicks another link, it appears to them that nothing happens and your site is broken, even though it's loading in the window behind.

var day = new Date();
var id = day.getTime();
newwindow=window.open(url,id,'height=500,...........

2. The "yes" "1" or "on" values are not required for any boolean attributes in open(). Leaving them off equals no, including them equals yes:
newwindow=window.open(url,id,'height=500,width=600,location,resizable,scrollbars, menubar');

3. Lastly, your content is INACESSIBLE if Javascript is disabled or not supported, because there's not likely any page called "javascript:" on your site. :-) By making the small change below, this allows users to get to your content with JS disabled. The "return false" only executes if JS is enabled, and tells the browser to NOT follow the link. Try it:

<a href="http://www.example.com/Homelife/inventory.asp?subd=Ashley Place&cnty=Douglas&county=Douglas&subdivision=Ashley Place&lb=Hlcm01&source=GAMLS" onClick="openWindow(http://www.example.com/Homelife/inventory.asp?subd=Ashley Place&cnty=Douglas&county=Douglas&subdivision=Ashley Place&lb=Hlcm01&source=GAMLS'); return false;">View
Available Homes</a>

All in all - it really sounds to me like new window is a much better choice. :-D

adb64

7:41 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



It also gave me too much troubles and a headache so I finally resorted to opening a new window with HTML content and an embedded object to show the movie