Resize window etc to look like a pop-up

N

Nigel Mercier ®

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?
 
D

David Dorward

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.
 
N

Nigel Mercier ®

[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.
 
N

nice.guy.nige

[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. (e-mail address removed). Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"How strange the change from major to minor..."
 
D

David Dorward

DU said:
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.
 
N

Nigel Mercier ®

In said:
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:eek:nClick=openIt()">Click here to open a
calculator</a>
 
J

Jim Ley

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.
 
D

DU

David said:
DU wrote:




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/doctorunclear/Netscape7/Netscape7Section.html
 
D

DU

HikksNotAtHome said:
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/doctorunclear/Netscape7/Netscape7Section.html
 
G

Grant Wagner

Nigel Mercier ® said:
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:eek:nClick=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.

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 <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_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-developer/upgrade_2.html
 
N

Nigel Mercier ®

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.
 
L

Lasse Reichstein Nielsen

Grant Wagner said:
"Nigel Mercier ®" wrote:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top