473,770 Members | 6,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.open, Linux vs. Windows

I'm a complete Javascript n00b, using a snippet I found on the web.
I'll probably be buying a Javascript book. What's the authoritative
on-line resource for Javascript, like php.net is for PHP? I'm a
relative PHP n00b.

This code works fine on Opera & Mozilla under Linux, but fails for both
Netscape & IE under Windows:

<script language="JavaS cript">
<!--
function smallWindow(URL , X, Y, Title)
{
var win = window.open(URL , Title,
'width='+X+',he ight='+Y+',resi zable=1,scrollb ars=1');
}
// -->
</script>

<form name="form1" method="post" action="">
<html>
<head>
etc.
a ton of PHP code echoing HTML, including:

echo '<a href="javascrip t:onclick=small Window(\'unitco nverter.php\',
\'250\', \'150\', \'Convert Units\');">';
echo 'Unit Conversion Calculator';
echo '</a>';
I can open unitconverter.p hp stand-alone, as well as via a simple

<a href="unitconve rter.php" target="new window">.

It's only when I go through Javascript that it fails with nothing more
than a friendly "Error in page" message from IE, while Netscape is mute.

--
Lynn Wallace http://www.xmission.com/~lawall
"I'm not proud. We really haven't done everything we could to protect
our customers. Our products just aren't engineered for security."
--Microsoft VP in charge of Windows OS Development, Brian Valentine.

Jul 20 '05 #1
2 3960
Raptor <me@attbi.com > writes:
I'm a complete Javascript n00b, using a snippet I found on the web.
I'll probably be buying a Javascript book. What's the authoritative
on-line resource for Javascript, like php.net is for PHP?
I don't think there is *one* authoritative reference, mainly because
there is more than one implementation of this thing called "Javascript ".
I have some links at
<URL:http://www.infimum.dk/HTML/references.html #ref_1_4>
They are all more or less relevant. The first one is ofcourse the
best (the FAQ for this group :).
This code works fine on Opera & Mozilla under Linux, but fails for
both Netscape & IE under Windows:
"fails" is not a very imformative error report.

Which Netscape? Netscape 4 and Netscape 6+ are completely unrelated
browsers. In both cases, you can see Javascript errors in the Javascript
console. It is activated by entering "javascript :" in the address line.
<script language="JavaS cript">
In HTML 4 and later, the type attribute is required. A Javascript
script tag is written:
<script type="text/javascript">
<!--
You don't need HTML comments in Javascript.
function smallWindow(URL , X, Y, Title)
{
var win = window.open(URL , Title,
'width='+X+',he ight='+Y+',resi zable=1,scrollb ars=1');
This looks reasonable (if you can accept that window.open isn't always
working at all any more - popup-blockers are getting very popular and
browsers on restricted platforms like mobile phones or WebTV can have
problems with extra windows).

No need for "var win =". It is a local variable in a function that
ends right after the assignment, so the value is lost anyway.

}
// -->
</script>

<form name="form1" method="post" action="">
<html>
<head>
You must have <html> or <head> before other HTML tags. The form
tag right before it can only exist inside the body of the HTML
page. That means that the browser inserts an implicit <body>,
and the <html> and <head> are illegal tags inside the body.

Try validating the generated HTML with, e.g., the W3C validator.
etc.
a ton of PHP code echoing HTML, including:
Generally, in this group, we only care about the HTML code that is
produced by the PHP, not the PHP code itself. If the page fails to
work, there is a bug in the HTML, and it is easier to find the bug
without the PHP around it.
echo '<a href="javascrip t:onclick=small Window(\'unitco nverter.php\',
\'250\', \'150\', \'Convert Units\');">';
The generated HTML code would be:
---
<a href="javascrip t:onclick=small Window('unitcon verter.php',
'250', '150', 'Convert Units');">Unit Conversion Calculator</a>
---
The FAQ recommends against using javascript:-URL's. Use the
onclick handler instead and put a meaningful link in the href.

You actually assign the return value of smallWindow (which is the
undefined value) to a global variable called "onclick". Maybe you
were trying to use the onclick handler?

Spaces are not allowed in window names! This can be your real problem.

I.e., use:
---
<a href="unitconve rter.php" target="Convert Units"
onclick="smallW indow(this.href ,'250','150',th is.target);retu rn false;">
Unit Conversion Calculator</a>
--- I can open unitconverter.p hp stand-alone, as well as via a simple

<a href="unitconve rter.php" target="new window">.
Don't use spaces in window names!

If you want to open a new window each time, use the target "_blank" instead.
<URL:http://www.infimum.dk/HTML/JSwindows.html# ref_3_1>
It's only when I go through Javascript that it fails with nothing more
than a friendly "Error in page" message from IE, while Netscape is
mute.


IE can give more informative error messages (not great, but better
than "Error in page"). To enable it, uncheck the option:
Tools > Options > Advanced > Browsing / Disable script debugging

Alternatively, you can install the MS Script Debugger. I am not
impressed by it, but it does show the line of the bug.

Good luck.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
This code works fine on Opera & Mozilla under Linux, but fails for
both Netscape & IE under Windows:

"fails" is not a very imformative error report.


That's all I knew at the time, being so new at this.

(Snipped) a whole heaping crapload of tremendously useful information.
Thank you very much, Lasse! :-)

I'll be looking for opportunities to pay it forward.

--
--
Lynn Wallace http://www.xmission.com/~lawall
"I'm not proud. We really haven't done everything we could to protect
our customers. Our products just aren't engineered for security."
--Microsoft VP in charge of Windows OS Development, Brian Valentine.

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
10178
by: Edwin Boersma | last post by:
Hi, I've just installed Netscape 7.1 for Linux and the following script refuses to open a window when I call this function: function OpenLinkWindow() { wMap=window.open('http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map=','','width=400,height=600'); wMap.onResize = 'self.location.href=http://naxos.orangeport.net/cyclades-info/ShowMap.php?id_advert=45&map='
4
7707
by: J Fisk | last post by:
Hi, I've been banging my head on the wall over this for about two days now so any thoughts are much appreciated. I have a static .svg file with embedded onclick="open()"'s all over. The svg is <embed>ded in a minimal .html file. The onclick's work fine in IE w/Adobe SVG viewer 3: click and a new
14
11096
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
6
4760
by: zdp | last post by:
Dear all: I made a window program by wxPython. Split windows, treectrl, listctrl and textctrl are used. When I program in python, the look & feel of the window controls are like the windos XP look & feel, with thin and flat border (My os is window XP). It's natural because, as I know, wxPython use native look and feel. But when I convert the program to EXE file by Py2exe, and run it, the look & feel is bad. It's just like the windows...
21
18176
by: alistair_henderson | last post by:
Morning All, I have some code for a website which uses 'window.open' to simulate modal dialog boxes. I use the window.closed property to decide if the window object exists at various points. This has been fine until last week when I started getting javascript 'Permission Denied' errors when I try to access this property. I suspect that a windows update has caused this somehow, as this code has not changed for a very long time. Can...
6
2043
by: Howard Rifkin | last post by:
Hi, I my Javascript I popup an authentication window using the command; unamePasswdWindow = open("auth.html","","width=500,height=100"); This works fine in IE, and in Firefox 2.x on Windows and Linux, but the open() just returns a null in Firefox 1.5 on Tru64 Unix.
10
2974
by: iwl | last post by:
Hi, I tryed askstring to input some text in my script, but some ugly empty Window appears with the Input-Window behind and all together behind my Console showing my script. So all have to brought to the top first by the user - very unconfortable
4
3207
by: gaurav kashyap | last post by:
Dear all, I am using Microsoft Windows XP.Using putty.exe,I connected to LINUX server and a terminal window gets opened.Here i logeed in as root. What i want to do is open another terminal window from already opened terminal window. Can this be achieved.If yes,please provide a tested solution Thanks
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.