/    Sign up×
Community /Pin to ProfileBookmark

A question on popups

How do i do the following:

When the page loads, i want a popup to come asking if i want to set the page as a homepage. i know this is annying, but i am doing it for a javascript section in my website. Please help.

This is the site

[url]www.dragonslair.co.nr[/url]

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@PittimannDec 03.2003 — Hi!

Please go here to check out some code for your "user's homepage stuff" if you don't know how to do that:

http://javascript.internet.com/page-details/set-homepage-link.html

As far as your popup is concerned, have a look at this:
[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
function openwin() {
var wintitle = "popup"; // popup title
var width = "400"; // popup width
var height = "250"; // popup height
LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
windowproperties =
'height='+height+',width='+width+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no';
newwin = window.open('', wintitle, windowproperties);
newwin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>'+wintitle+'</title></head><body><center>Put your link for setting your page as the homepage of the user here...<br><br><a href="javascript:window.close();" title="&nbsp;Close this window...&nbsp;">click here to close window</a></center></body></html>');
}
</script>
</head>
<body onload="openwin()">
Your page's content...</body>
</html>
[/code]

Cheers - Pit
Copy linkTweet thisAlerts:
@aommasterauthorDec 03.2003 — I think u understood me wrong.

This is how i wanted it to be. I want it so that as the page loads, an alert box asking to set the homepage to this site. The link u have given me shows me how to set the homepage using a link (which i already know how to use). Now, using this code, i want it so that, immediately after the page loads, this come up automatically.

Thanx
Copy linkTweet thisAlerts:
@PittimannDec 03.2003 — Sorry - but you've asked for a popup and I gave you one! You didn't ask for an alert and plus: a simple "alert box" is not able to give the user any choice. It just contains an OK button.

Seems you misunderstood my code - if you don't want a popup window you need a "confirm box".

If you told me what you actually want I'll post another code here, but the one I already posted should be sufficient for you.

In the document.write of the function, you just have to replace the sentence "Put your link for setting your page as the homepage of the user here..." with your link.

I just put the link at the beginning of my last post, INCASE you do not know, how to accomplish that part...

Cheers - Pit
Copy linkTweet thisAlerts:
@aommasterauthorDec 03.2003 — sorry about that. I better explain it to you in a little more detail so u dont trouble urself.

Ok, you know the set as homepage prompt. The one that asks you whether you want to set this page as ur homepage.

I want this to come up right after the page loads, without anyone clicking a link

Thanx for ur help
Copy linkTweet thisAlerts:
@PittimannDec 03.2003 — I'm not troubling myself ?!

So you are talking about the confirm box with "yes" and "no" (maybe: "OK" and "Cancel" in English - I don't know).

As you asked for a popup (in your post itself and its' subject), I was convinced, that you want a more individual solution than the confirm box.

In whatever way you handle the thing:

A user who wants to set your page as homepage has to click something ("yes" or "ok" in the confirm box or the link I proposed in the popup).

Somebody who doesn't want that has to click "no" or "cancel" in the confirm box or close the popup.

One click for everybody - however you solve it. So what's bad about the popup I gave you???

Cheers - Pit
Copy linkTweet thisAlerts:
@aommasterauthorDec 03.2003 — Now u have understood me. U r talking about exactly what i wanted.

Actually, i know that it is quite an easy way to set as a homepage, but i just wanted it for the knowledge. I just wanted it so that i could see how poeple actually do it.

Do u actually know how to do it? Just out of curiosity.
Copy linkTweet thisAlerts:
@PittimannDec 03.2003 — Just to satisfy your curiosity - I know how to do it.

I was about to write something a bit sarcastic - I'll just leave it out.

Well, to come to the point: the box you're talking about is IE specific.

It would be possible, to inform non IE users how to set your page as their homepage -

i'll leave that up to you. Frankly speaking, I hate pages popping up that stuff.

If I want to make a page my homepage I can do that myself -

no need for shit popping up (sorry - do not want to insult you!).

I just prefer going to some page and read content, look at graphics, download something etc.,

but not be disturbed by having to click away popups or boxes!

Here's the code:
<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled&lt;/title&gt;
&lt;script language="JavaScript" type="text/javascript"&gt;
&lt;!--
function homePage(){
if (document.all){
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.YourWebSiteHere.com');
}
}
//--&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="javascript:homePage()"&gt;
&lt;/body&gt;
&lt;/html&gt;

Cheers - Pit
Copy linkTweet thisAlerts:
@aommasterauthorDec 04.2003 — Thanx alot. Actually, to be honest, i also hate this sort of stuff. I actually just did it for the knowledge. Thanx alot again.
Copy linkTweet thisAlerts:
@PittimannDec 04.2003 — You're welcome!! ?
Copy linkTweet thisAlerts:
@aommasterauthorDec 04.2003 — This is really wierd.

I tried to use it as a test, but it says there is a runtime error.

Why is that happening???
Copy linkTweet thisAlerts:
@PittimannDec 04.2003 — No idea! It should work fine in IE.

But one thing - in the line:

<body onload="java script:homePage()">

you have to delete the space between "java" and "script" (it is automatically inserted when posting that word...).

Cheers - Pit
Copy linkTweet thisAlerts:
@aommasterauthorDec 04.2003 — Ok it works. That was the reason. And one more thing,

UR A GENIUS!! Thanx alot
×

Success!

Help @aommaster spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...