473,378 Members | 1,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 7927
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Charles Packer | last post by:
From one of the online Javascript tutorials, I learned how to open a new window and set its size. I'm building a page that has several small photographs, and I want to let the viewer examine...
4
by: David Logan | last post by:
Hello, I am trying to open a window with a graphic in it and have the window be exactly the correct size of the image. Is there anyway to do this that will work on any browser on any OS???? ...
2
by: arkascha | last post by:
Hi everybody, after trying 'round for hours and wishing all browser engine programmers to hell :-) I'd like to ask if anyone knows a solution for this: A dynamically created html page contains a...
8
by: Michael Satterwhite | last post by:
I'm opening a page that has a single image on it. I'd like to resize the window containing the image to the size of the image (slightly larger OK, not smaller). The width isn't a problem, but the...
2
by: Peter | last post by:
I would like to automatically resize a window to its content. I was thinking of using an outer table to detect the size of my content, then use window.resizeTo( ). The problem is I'm not sure...
5
by: Ian Stiles | last post by:
I have tried everything under the sun to get rid of horrible flashing and flickering that occurs on a CSharp form when the form hosts a TreeView or WebBrowser control and then you resize the form....
6
by: varois83 | last post by:
Hi Does it matter if a site built with CSS resize nicely or not? I see some very fluid that even with the browser window reduced to 30%, the site still looks the same, others do not resize at...
69
by: RC | last post by:
I know how to do this in JavaScript by window.open("newFile.html", "newTarget", "scrollbars=no,resizable=0,width=200,height=200"); The browser will open a new window size 200x200, not allow...
6
by: Piotrekk | last post by:
Hi I was wandering if is this possible to resize window in steps different than 1 px. Thanks PK
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.