Welcome to WebmasterWorld Guest from 18.205.176.85

Forum Moderators: phranque

Message Too Old, No Replies

Repost: Really need your help, folks!

How to set an Internet Shortcut to open a fixed-sized window

     
8:53 pm on Sep 30, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:July 17, 2003
posts:82
votes: 0


Hi folks

Interesting problem I've got...

I want to create an Internet Shortcut link that users can download and put on their desktop.

The link needs to open a window which has a fixed size, no scrollbars, no status bar, not resizeable etc - rather like a popup window. It mustn't open a normal window first.

I think it might be do-able with some Javascript, becuase I vaguely remember having such a link which opened multiple windows with one click (something to do with giving to multiple charity sites, I think).

I've been struggling with this one over the past few days, but I haven't got anywhere with it.

Any ideas? Help would be very much appreciated.

D.

8:59 pm on Sept 30, 2003 (gmt 0)

Full Member

10+ Year Member

joined:July 2, 2003
posts:306
votes: 0


don't know if you can do this straight from the user's desktop. You'd probably need an in-between or 'landing' page of some sort.

i.e. the shortcut points to the landing page, landing page fires a popup with the correct specs, and then itself closes onBlur or something so the customer is left with only the popup.

It would be cool if you can find a way to do it right off the shortcut, but I doubt it exists since you can't run javascript outside of the browser.

9:16 pm on Sept 30, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Sept 26, 2002
posts:334
votes: 0


here's some code that i've used in the past.

should do what you want...it may seem long, but it's a way to get around the dialog box that opens asking you to close the page if you try the simple window.close()

##########page to open first#########

<html>
<head>
<title>1.htm - opener</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function openWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body onLoad="openWindow('2.htm?yup=1','','width=300,height=300')">
</body>
</html>

#### basic code for the popup page (2.htm) ######

<html>
<head>
<title>1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/JavaScript">
<!--
function closeParent(){
try{
var q = queryString("yup");
if( q=="1" ){
var op = window.opener;
op.opener = self;
op.close();
}
}
catch(er)
{}
}

function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}
//-->
</script>
</head>

<body onLoad="closeParent()">
</body>
</html>

9:18 pm on Sept 30, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Sept 26, 2002
posts:334
votes: 0


er...maybe not, that does open a page in the interim there. sorry about that...lemme think
9:20 pm on Sept 30, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Sept 26, 2002
posts:334
votes: 0


k...how about this. Use flash, make a .swf or even a .exe and you can open windows with parameters straight from there.
6:26 am on Oct 1, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:July 17, 2003
posts:82
votes: 0


Not sure about Flash - might limit the audience.

But, if the parent window closes, I think I could live with that.

Thanks a lot for that, hooloovoo. I'll try that out today.

That's the first lead into this problem I've had over the past few days :-)

D.

3:47 pm on Oct 1, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Sept 26, 2002
posts:334
votes: 0


no problem, let me know if it works for you
4:28 pm on Oct 3, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:July 17, 2003
posts:82
votes: 0


Hooloovoo

I tried out your solution. At first it worked well as a shortcut from the desktop, but after a couple of goes, it crashed my browser (IE6)!

I finally got someone to program a small executable, which does the trick nicely. It also means that the user will have a special icon on the desktop.

But someone else came up with another direct HTML solution, which works neatly. You might be interested in this solution:

<HTML>
<HEAD>
<TITLE> TEST DOC </TITLE>
</HEAD>
<BODY>
<script language="JavaScript">
<!--
top.window.moveTo(3000,30000);
top.window.resizeTo(1,1); open('http://www.mysite.com/file.html','blwy','width=160,height=230,scrollbars=no,menubar=no,directories=no,status=no,titlebar=no');window.opener=''; window.close();
--></script>
</BODY>
</HTML>

Thanks, anyway, for your help.

D.