472,145 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Resize window etc to look like a pop-up

I'm just starting to learn JavaScript, so far I like it!

I want to add some JS to my Ebay listings, to manually open a pop-up
window. It works OK, but the JS gets rejected by Ebay.

If I can't use JS in my listing, is there a way of using JS to resize a
current window, and remove the toolbars etc, so it looks like a pop-up?
--
Nigel Mercier

Please remove NOSPAM from my return address
Jul 20 '05 #1
14 7831
Nigel Mercier ® wrote:

I want to add some JS to my Ebay listings, to manually open a pop-up
window. It works OK, but the JS gets rejected by Ebay.

If I can't use JS in my listing, is there a way of using JS to resize a
current window
Yes... but its very annoying and is blocked by most decent browsers.
, and remove the toolbars etc, so it looks like a pop-up?


No.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #2
In comp.lang.javascript, David Dorward wrote:
[resize windows] very annoying and is blocked by most decent browsers.


Perhaps I should mention that I want to open a new window when the user
clicks a link, and it's that window that I want to resize etc.

Failing that, is there a way to make the document.close() method work
without bringing up a warning prompt? I could then use an intermediate
window to launch the pop up.

Any other suggestions welcome.
--
Nigel Mercier

Please remove NOSPAM from my return address
Jul 20 '05 #3
While the city slept, Nigel Mercier ® <ni*********************@virgin.net>
feverishly typed:
In comp.lang.javascript, David Dorward wrote:
[resize windows] very annoying and is blocked by most decent
browsers.


Perhaps I should mention that I want to open a new window when the
user clicks a link, and it's that window that I want to resize etc.

Failing that, is there a way to make the document.close() method work
without bringing up a warning prompt? I could then use an intermediate
window to launch the pop up.

Any other suggestions welcome.


I think it's time for someone to read the FAQ's:
http://www.jibbering.com/faq

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. ni***@nigenetDOG.org.uk. Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"How strange the change from major to minor..."
Jul 20 '05 #4
DU wrote:
Rather than resize an already created and opened requested popup, why
not set the window dimensions for such window before creating it.


Becuase, as the OP stated in his initial post, Ebay filters JavaScript out.
So the page with the link on it can't include a window.open. Any scripting
has to be done on the page linked too.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #5
In comp.lang.javascript, Nigel Mercier ® wrote:
That's the problem, I can't use JS on the initial page, see OP.


Sorry, sent this before I meant to <rummage: finds glasses>

I realize that I haven't given you kind folks enough info, so here is
the code that I wanted to use on Ebay, but I can't because they don't
allow JS.
<script LANGUAGE="javascript">

function openIt()
{
window.open('http://homepage.virgin.net/hosting.services/ebay/ppfees.htm',
'fred', config='height=180,width=400');
}

</SCRIPT>

<a href="javascript:onClick=openIt()">Click here to open a
calculator</a>

--
Nigel Mercier

Please remove NOSPAM from my return address
Jul 20 '05 #6
In article <bh************@ID-112325.news.uni-berlin.de>, "nice.guy.nige"
<ni********@deadspam.com> writes:

I think it's time for someone to read the FAQ's:
http://www.jibbering.com/faq


Agreed, but, with respect to closing windows that js didn't open, the FAQ is
utterly wrong.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #7
On 17 Aug 2003 17:55:11 GMT, hi************@aol.com (HikksNotAtHome)
wrote:
In article <bh************@ID-112325.news.uni-berlin.de>, "nice.guy.nige"
<ni********@deadspam.com> writes:

I think it's time for someone to read the FAQ's:
http://www.jibbering.com/faq


Agreed, but, with respect to closing windows that js didn't open, the FAQ is
utterly wrong.


Because of browser bugs you mean? or something else?

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #8
In article <3f****************@news.cis.dfn.de>, ji*@jibbering.com (Jim Ley)
writes:
Because of browser bugs you mean? or something else?

Jim.


http://tinyurl.com/kaez
and links therein.

Shows the results of this script:

window.opener = window;
window.close();

It may indeed be a bug, but if it is, then its a very very wide spread one.

Netscape 4.06 - Prompts the user about trying to close a window (I didn't see
this message, someone else tested it for me).
Netscape 4.80 - closes window without a prompt.
IE5.0 - prompts the user.
IE5.5 - closes the window without a prompt.
IE6.0 - closes the window without a prompt.
Netscape 7 - closes the window without a prompt.
Opera 7 - closes the window without a prompt.
Opera 6.05 - closes the window without a prompt.
Phoenix 0.5 - closes the window without a prompt.
Mozilla 1.4 - No prompt, just an error message "Scripts may not close windows
that were not opened by script." in the Javascript console.

Netscape, Opera and other "tabbed" browsers, it doesn't close the entire
browser,
just the active tab (if its set to use tabs).
MAC browsers:

AOL For Mac OSX v. 10.3 - closes the window without a prompt.
IE 5.2.2 for Mac - closes the window without a prompt.
omniWeb on MacOSX - closes the window without a prompt.

Netscape 7.02 for Mac OSX Does nothing, and after attempting to open,
Netscape must be rebooted

The MAC testing wasn't done by me, so not sure exactly how they work.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #9
On 17 Aug 2003 18:21:27 GMT, hi************@aol.com (HikksNotAtHome)
wrote:
In article <3f****************@news.cis.dfn.de>, ji*@jibbering.com (Jim Ley)
writes:
Because of browser bugs you mean? or something else?


It may indeed be a bug, but if it is, then its a very
very wide spread one.


It's still a bug, (as in, works in violation of the documented
behaviour of those browsers)

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #10
DU
David Dorward wrote:
DU wrote:

Rather than resize an already created and opened requested popup, why
not set the window dimensions for such window before creating it.

Becuase, as the OP stated in his initial post, Ebay filters JavaScript out.
So the page with the link on it can't include a window.open. Any scripting
has to be done on the page linked too.


Thanks for the clarification. I did not know that and did not quite
understood the "JS gets rejected by Ebay" part of the OP initial post
..... thought it was JS functions not working.

The problem is that Mozilla-based browser users can disable resizeTo and
moveTo calls. I personally do this to prevent abuse and I recommend
people to not give a single chance to resizeTo and moveTo methods:
scripters should never be relying on these methods.

In any case, as long as the new window/requested popup is resizable and
has scrollbars if needed, the initial window dimensions and positions
are not that important.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #11
DU
HikksNotAtHome wrote:
In article <3f****************@news.cis.dfn.de>, ji*@jibbering.com (Jim Ley)
writes:

Because of browser bugs you mean? or something else?

Jim.

http://tinyurl.com/kaez
and links therein.

Shows the results of this script:

window.opener = window;
window.close();


I also tested
window.opener = "fred";
window.close();

and Mozilla 1.4, 1.5b and NS 7.1 will report a conversion error
(NS_ERROR_XPC_BAD_CONVERT_JS).

It may indeed be a bug, but if it is, then its a very very wide spread one.

Netscape 4.06 - Prompts the user about trying to close a window (I didn't see
this message, someone else tested it for me).
Netscape 4.80 - closes window without a prompt.
IE5.0 - prompts the user.
IE5.5 - closes the window without a prompt.
IE6.0 - closes the window without a prompt.
Netscape 7 - closes the window without a prompt.
NS 7.1 does not close the window.
Opera 7 - closes the window without a prompt.
Opera 7.20b3 closes the page (active tab) without a prompt. Amazing...
Opera 6.05 - closes the window without a prompt.
Phoenix 0.5 - closes the window without a prompt.
Mozilla 1.4 - No prompt, just an error message "Scripts may not close windows
that were not opened by script." in the Javascript console.

Mozilla 1.5b does not close the window.
Netscape, Opera and other "tabbed" browsers, it doesn't close the entire
browser,
just the active tab (if its set to use tabs).
MAC browsers:

AOL For Mac OSX v. 10.3 - closes the window without a prompt.
IE 5.2.2 for Mac - closes the window without a prompt.
omniWeb on MacOSX - closes the window without a prompt.

Netscape 7.02 for Mac OSX Does nothing, and after attempting to open,
Netscape must be rebooted

The MAC testing wasn't done by me, so not sure exactly how they work.


I personally do not like to see scripters being able to close windows
not opened by javascript. This can and would definitively lead to abuse,
malicious scripts, etc..

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #12
"Nigel Mercier ®" wrote:
In comp.lang.javascript, Nigel Mercier ® wrote:
That's the problem, I can't use JS on the initial page, see OP.


Sorry, sent this before I meant to <rummage: finds glasses>

I realize that I haven't given you kind folks enough info, so here is
the code that I wanted to use on Ebay, but I can't because they don't
allow JS.

<script LANGUAGE="javascript">

function openIt()
{
window.open('http://homepage.virgin.net/hosting.services/ebay/ppfees.htm',
'fred', config='height=180,width=400');
}

</SCRIPT>

<a href="javascript:onClick=openIt()">Click here to open a
calculator</a>

--
Nigel Mercier


Your JavaScript is completely wrong, and that's most likely the reason it's
not working on eBay.

window.open() takes 3 parameters, the first is the URL, the second is the name
of the window, the 3rd is a comma-delimited list of attributes to be applied
to the window. The phrase "config=" shouldn't appear anywhere in an open()
method invocation.

I'd suggest before attempting to use JavaScript on a service like eBay, you
actually learn the basics of scripting first, either locally or on the
webspace provided by your ISP.

<script type="text/javascript">
function openIt(url, name, attributes) {
window.open(url, name, attributes);
}
</script>

<a href="http://host/path/file.html"
target="fred"
onclick="openIt(this.href, this.name, 'height=180,width=400'); return
false;">Link</a>

Now, if JavaScript is enabled you will get a window with your choice of width
and height. If JavaScript is disabled or filtered by a proxy, the link will
(should) still produce a new window with your URL loaded into it. I say
"should" because some browsers can be configured so that even TARGET="..." is
ignored and the link is opened in the current browser window.

By the way, I don't believe eBay does anything to script embedded in ads. I
remember a recent eBay posting that used script to open your CDROM drive door,
so I don't believe they filter it (although since that incident they may have
started filtering it). Regardless, I /know/ your script contained errors, so
that's the first place to start.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #13
In comp.lang.javascript, Grant Wagner wrote:
our JavaScript is completely wrong, and that's most likely the reason it's
not working on eBay.
It works just fine thanks, just not on Ebay (they don't allow it).
I'd suggest before attempting to use JavaScript on a service like eBay, you
actually learn the basics of scripting first


Thanks for your very kind and helpful encouragement.
--
Nigel Mercier

Please remove NOSPAM from my return address
Jul 20 '05 #14
Grant Wagner <gw*****@agricoreunited.com> writes:
"Nigel Mercier ®" wrote:
<script LANGUAGE="javascript">
function openIt()
{
window.open('http://homepage.virgin.net/hosting.services/ebay/ppfees.htm',
'fred', config='height=180,width=400');
}
</SCRIPT>

<a href="javascript:onClick=openIt()">Click here to open a
calculator</a>

Your JavaScript is completely wrong, and that's most likely the reason it's
not working on eBay.


Not completely wrong. It is syntactically correct and should work as
expected in most browsers. It just has some unnecessary additions
("config=", "onClick=") that looks like black magic ("I'll add this, I
don't know why!"). They probably won't hurt, but they sure don't do
anything good either.

Apart from that, your suggestions are good. Remove the "magic words",
change the javascript: href to an onclick event handler, and change
the "language" attribute to a "type" attribute.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Charles Packer | last post: by
4 posts views Thread by David Logan | last post: by
2 posts views Thread by arkascha | last post: by
8 posts views Thread by Michael Satterwhite | last post: by
2 posts views Thread by Peter | last post: by
6 posts views Thread by varois83 | last post: by
6 posts views Thread by Piotrekk | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

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.