PDA

View Full Version : firefox pop up window


ascskate
09-12-2006, 08:51 AM
ok, on www.skateperception.com when viewed in IE is has a pop up that say like switch to firefox blah blah blah. how can u do this? im pretty sure its java script and if so does anyone kno the code to do it. if u need to see wat im talking about vist the page in IE. i use FF myself but at my school they use IE and thats where i saw the pop up. i really want this to be incorporated into my site.

thanks in advance.


ascskate

Kravvitz
09-13-2006, 12:53 AM
Yes, that's done with JavaScript.

The code in that page wasn't written very well, but you could just view the source and see how they did it yourself.

ascskate
09-13-2006, 07:32 AM
i tried but i figuere out wat to do. java script and me arent the best of friends:P

if you could help me get the code then i would be very thankful


ascskate

thereal88
09-13-2006, 07:41 AM
You can use the following JavaScript function:

window.open ("http://www.thelinkyouwant.com", "thenameofthewindow","thingsyouwantinthewindow");

The name of the window is not directly important, unless you want to do things with it from other windows.
The things you want in the window are things like the address bar and scrollbars. Here's a list of things you can use:

status - The status bar at the bottom of the window.
toolbar - The standard browser toolbar, with buttons such as Back and Forward.
location - The Location entry field where you enter the URL.
menubar - The menu bar of the window
directories - The standard browser directory buttons, such as What's New and
resizable - Allow/Disallow the user to resize the window.
scrollbars - Enable the scrollbars if the document is bigger than the window
height - Specifies the height of the window in pixels. (example: height='350')
width - Specifies the width of the window in pixels.

Most of these have 1 or 0 variables. 1 is ON, 0 is OFF.
How to input: example:
"toolbar=1,status=1,width=400,height=100"
Example of entire function:
window.open("http://www.google.com","mywindow","toolbar=1,status=1,width=400,height=100")

more info: http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

ascskate
09-13-2006, 08:07 AM
yah but how would i get it to open when someone was using IE?? thats the only time i want it to pop up.


ascskate

ascskate
09-13-2006, 08:09 AM
i should prolly reword my first post. its not really a pop up but kinda a banner that shows up before the rest of the site does. you have to see it to understand.


ascskate

Kravvitz
09-13-2006, 08:23 AM
yah but how would i get it to open when someone was using IE?? thats the only time i want it to pop up.
I would use the following to determine of the browser being used was IE.
var isIE = (document.defaultCharset && !window.home);

ascskate
09-13-2006, 08:25 AM
thanks for that but i just found this site www.explorerdestroyer.com it is awesome. just what i was looking for. thanks for your help anyways. ill be sure to add to ur rep.


ascskate

ascskate
09-13-2006, 08:29 AM
ughhhh. its not working. i put the code in. left it just like i got from the site but its not working. wat am i doin wrong.


heres my code
<!--
// set daysToSleep to the number of days you want the Banner to sleep.
// if you use 0, then the banner will only show again after the user closes his/her browser
// if you use -1, then the banner will show on every page, every time
var daysToSleep =1;

var hasIE_phone_home = 1;

//added functions to use cookies to show users the notice every daysToSleep
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

// This function does the actual browser detection
function hasIE_hasIE() {
var ua = navigator.userAgent.toLowerCase();
return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) &&
(ua.indexOf('webtv') == -1) &&
(location.href.indexOf('seenIEPage') == -1));
}

function hasIE_showOnlyLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer);
}
else if (document.all)
{
var style2 = document.all[whichLayer];
}
else if (document.layers)
{
var style2 = document.layers[whichLayer];
}
var body = document.getElementsByTagName('body');
body[0].innerHTML = style2.innerHTML;
}

function hasIE_showLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer).style;
style2.display = "block";
}
else if (document.all)
{
var style2 = document.all[whichLayer].style;
style2.display = "block";
}
else if (document.layers)
{
var style2 = document.layers[whichLayer].style;
style2.display = "block";
}
}

function hasIE_moveAd(adid) {
if (document.getElementById)
{
var ad = document.getElementById('hasIE_ad');
var adloc = document.getElementById(adid);
}
else if (document.all)
{
var ad = document.all['hasIE_ad'];
var adloc = document.all[adid];
}
else if (document.layers)
{
var ad = document.layers['hasIE_ad'];
var adloc = document.layers[adid];
}
adloc.innerHTML = ad.innerHTML;
}

// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow() {
if (hasIE_hasIE()) {
if (readCookie('xaviersCookie') == null){
hasIE_showOnlyLayer("hasIE_level2");
createCookie('xaviersCookie','seenIEBanner',daysToSleep);
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage2');
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage2');
}
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage0');
}
}

function hasIE_phoneHome(image) {
if (document.getElementById)
{
var img = document.getElementById(image);
}
else if (document.all)
{
var img = document.all[image];
}
else if (document.layers)
{
var img = document.layers[image];
}
img.setAttribute('src','http://getunder50.com/ping.php?host='+location.host);

}

function hasIE_ContinueWithoutFF() {
if (location.href.indexOf('?') != -1)
location.href += '&seenIEPage=1';
else
location.href += '?seenIEPage=1';
}

-->

</script>

<span style="position:absolute; width: 0px; height:0px; left:-1000px; top: -1000px"><img id="getIE_pingimage0"/></span>

<!-- LEVEL 2: SPLASH WITH CLICK THROUGH -->

<div id="hasIE_level2" style="display: none;">
<span style="position:absolute; width: 0px; height:0px; left:-1000px; top: -1000px"><img id="getIE_pingimage2"/></span>

<Br /><Br />

<div style="padding: 20px; background-color: #ffffbb; font-family: arial; font-size: 15px; font-weight: normal; color: #111111; line-height: 17px;">


<div style="width: 630px; margin: 0 auto 0 auto;">

<div style="padding-left: 10px; padding-top: 0px; float: right;">

<!-- REPLACE THIS BLOCK OF SCRIPT WITH YOUR OWN FIREFOX REFERRAL BUTTON -->

<script type="text/javascript"><!--
google_ad_client = "pub-3257193754894044";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as_rimg";
google_cpa_choice = "CAAQo-aZzgEaCM3CU97Siy5UKK2293M";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</div>
<strong>I see you're using Internet Explorer, which is not a safe way to browse the web. I strongly suggest downloading Firefox. It is not only compatible with my site but a better browsers all around. We think you'll like it better:</strong>
<br /><br />

<strong>•</strong> Firefox blocks pop-up windows.
<br />
<strong>•</strong> It's more secure against viruses and spyware.
<br />
<strong>•</strong> It keeps Microsoft from controlling the future of the internet.
<br />
<strong>•</strong> It's better for web designers and developers.
<br />
<strong>•</strong> Features like tabbed browsing make reading webpages easier.
<br /><br />
Click the button on the right to download Firefox. It's free.
<br /><br />
<a href="javascript:hasIE_ContinueWithoutFF();">Continue without Firefox >></a>
<br /><br />
</div>
</div>
</div> <!-- END EXPLORER DESTROYER --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<title>accelSKATEcrew</title>

<link rel="stylesheet" type="text/css" href="style.css" />
<!-- This page fully validates as XHTML 1.0 Strict on validator.w3.org (notice can be removed) -->
</head>

<body>
<div id="outer">
<div id="inner">

<div class="bgtext">accelskate</div>




<div id="text1"><a href="home.html">news<span>>whats up with ASC.</span></a></div>
<div id="text2"><a href="newvideopage.html">videos<span>>watch them</span></a></div>
<div id="text3"><a href="newpictures.html">pictures<span>>look at them.</span></a></div>
<div id="text4"><a href="newlinks.html">links<span>>other team sites</span></a></div>
<div id="text5"><a href="newteampage.html">The Team<span>>yah were cool.</span></a></div>



</div>
</div>

</body>

</html>

im really confused



ascskate

Kravvitz
09-13-2006, 09:02 AM
You can't just copy and paste it to the very beginning of the X/HTML file.

It's very badly written.

ascskate
09-13-2006, 10:12 AM
wat do i need to do then???

Kravvitz
09-13-2006, 10:29 AM
Learn X/HTML (and CSS). (http://www.htmldog.com/guides/)

ascskate
09-13-2006, 03:30 PM
wat is that gonna do? its java script, not x/html or CSS.

ascskate

Kravvitz
09-13-2006, 04:11 PM
Part of it is JavaScript, but part of it is X/HTML and CSS too.

The way you added it to your page indicates your severe lack of knowledge. Hence, you should read those guides.

I could just give you the code, but you'll learn more if you learn how to do it yourself.

ascskate
09-13-2006, 04:37 PM
The way you added it to your page indicates your severe lack of knowledge.

how do u think i made my site if i didnt kno html and css. dee dee dee (in the words of carlos mencia) i just didnt know where java script was supposed to be located in the code.

I could just give you the code, but you'll learn more if you learn how to do it yourself.

ill pass on the learning part. the code would be fine. :P :P
haha


ascskate

Kravvitz
09-13-2006, 05:13 PM
If you really knew HTML then you would know that nothing should come before the doctype and that JavaScript goes inside script elements (http://www.htmldog.com/reference/htmltags/script/).

ascskate
09-13-2006, 05:37 PM
o ****. i didnt even realize that i put it before the doctype.

woops..my bad

thanks for your help

ascskate

ascskate
09-15-2006, 08:30 PM
*bump*



ascskate

Kravvitz
09-16-2006, 12:04 AM
So what's the question?

ascskate
09-16-2006, 04:57 PM
the question is what do i need to do to get this to work?!?!?!?!?!?!?

Pegasus
09-16-2006, 05:40 PM
What have you done so far? Can we see the page? Or, at the very least, the code you're working with.

Peg

ascskate
09-16-2006, 09:02 PM
well peg im trying to get it like on this page www.skateperception.com (you gotta view it in IE to see what i mean)

and as to what I have done so far. i got the code from www.explorerdestroyer.com and it looks like this.

<!--
// set daysToSleep to the number of days you want the Banner to sleep.
// if you use 0, then the banner will only show again after the user closes his/her browser
// if you use -1, then the banner will show on every page, every time
var daysToSleep = 2;

var hasIE_phone_home = 1;

//added functions to use cookies to show users the notice every daysToSleep
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

// This function does the actual browser detection
function hasIE_hasIE() {
var ua = navigator.userAgent.toLowerCase();
return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) &&
(ua.indexOf('webtv') == -1) &&
(location.href.indexOf('seenIEPage') == -1));
}

function hasIE_showOnlyLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer);
}
else if (document.all)
{
var style2 = document.all[whichLayer];
}
else if (document.layers)
{
var style2 = document.layers[whichLayer];
}
var body = document.getElementsByTagName('body');
body[0].innerHTML = style2.innerHTML;
}

function hasIE_showLayer(whichLayer)
{
if (document.getElementById)
{
var style2 = document.getElementById(whichLayer).style;
style2.display = "block";
}
else if (document.all)
{
var style2 = document.all[whichLayer].style;
style2.display = "block";
}
else if (document.layers)
{
var style2 = document.layers[whichLayer].style;
style2.display = "block";
}
}

function hasIE_moveAd(adid) {
if (document.getElementById)
{
var ad = document.getElementById('hasIE_ad');
var adloc = document.getElementById(adid);
}
else if (document.all)
{
var ad = document.all['hasIE_ad'];
var adloc = document.all[adid];
}
else if (document.layers)
{
var ad = document.layers['hasIE_ad'];
var adloc = document.layers[adid];
}
adloc.innerHTML = ad.innerHTML;
}

// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow() {
if (hasIE_hasIE()) {
if (readCookie('xaviersCookie') == null){
hasIE_showOnlyLayer("hasIE_level2");
createCookie('xaviersCookie','seenIEBanner',daysToSleep);
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage2');
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage2');
}
} else {
if (hasIE_phone_home == 1)
hasIE_phoneHome('getIE_pingimage0');
}
}

function hasIE_phoneHome(image) {
if (document.getElementById)
{
var img = document.getElementById(image);
}
else if (document.all)
{
var img = document.all[image];
}
else if (document.layers)
{
var img = document.layers[image];
}
img.setAttribute('src','http://getunder50.com/ping.php?host='+location.host);

}

function hasIE_ContinueWithoutFF() {
if (location.href.indexOf('?') != -1)
location.href += '&seenIEPage=1';
else
location.href += '?seenIEPage=1';
}

-->

</script>

<span style="position:absolute; width: 0px; height:0px; left:-1000px; top: -1000px"><img id="getIE_pingimage0"/></span>

<!-- LEVEL 2: SPLASH WITH CLICK THROUGH -->

<div id="hasIE_level2" style="display: none;">
<span style="position:absolute; width: 0px; height:0px; left:-1000px; top: -1000px"><img id="getIE_pingimage2"/></span>

<Br /><Br />

<div style="padding: 20px; background-color: #ffffbb; font-family: arial; font-size: 15px; font-weight: normal; color: #111111; line-height: 17px;">


<div style="width: 630px; margin: 0 auto 0 auto;">

<div style="padding-left: 10px; padding-top: 0px; float: right;">

<!-- REPLACE THIS BLOCK OF SCRIPT WITH YOUR OWN FIREFOX REFERRAL BUTTON -->

<script type="text/javascript"><!--
google_ad_client = "pub-3257193754894044";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as_rimg";
google_cpa_choice = "CAAQo-aZzgEaCM3CU97Siy5UKK2293M";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</div>
<strong>We see you're using Internet Explorer, which is not a safe way to browse the web.&nbsp;&nbsp;We strongly suggest downloading Firefox. We think you'll like it better:</strong>
<br /><br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>&middot;</strong> Firefox blocks pop-up windows.
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>&middot;</strong> It's more secure against viruses and spyware.
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>&middot;</strong> It keeps Microsoft from controlling the future of the internet.
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>&middot;</strong> It's better for web designers and developers.
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>&middot;</strong> Features like tabbed browsing make reading webpages easier.
<br /><br />
Click the button on the right to download Firefox.&nbsp;&nbsp;It's free.
<br /><br />
<a href="javascript:hasIE_ContinueWithoutFF();">Continue without Firefox >></a>
<br /><br />
</div>
</div>
</div> <!-- END EXPLORER DESTROYER -->



where does this code need to go? ive tried it a few time but to no avail
i hope i spelled that right

you might wanna read about explorer destroyer. link ^

Pegasus
09-17-2006, 01:58 AM
Okay, I think you're missing a bit of the code. At the very least, you need <script type="text/javascript"> at the beginning of it and I believe that can be put in the <head> section of your page. The rest of it would go where you want the code to be set up.

I think.

You may have to wait until Jon Hanlon gets in. He knows all about Javascript and such.

Peg

Kravvitz
09-17-2006, 02:06 AM
*sigh* I already gave him the answer. Perhaps I was too subtle.

ascskate, I suggest you read the directions that are included in the html files that are in the zip file that you can download from that site.

My HTML Knowledge Level (http://www.456bereastreet.com/archive/200605/levels_of_html_knowledge/) is 5, what's yours?

Pegasus
09-17-2006, 02:24 AM
The page disappears on me. I had to read the article using the View>Page Source!

Peg

Kravvitz
09-17-2006, 02:26 AM
Which page?
What browser are you using?

¥åßßå
09-17-2006, 02:32 AM
<!--[if IE]>
<div style="position:absolute;left:50%;margin-left:-5em;border:2px dashed #f00;color:#400;background:#fcc;width:10em;text-align:center;padding:.5em">
<a href="http://www.mozilla.com/firefox/">Get firefox</a>
</div>
<![endif]-->

No js required ;)

¥

Pegasus
09-17-2006, 02:41 AM
Kravvitz, it's the HTML Level page that doesn't show up in NS7.02 on my Mac. Or rather, the article doesn't show up. Most of the comments do, and the header and sidebars. Just not the article.

Peg

Kravvitz
09-17-2006, 02:56 AM
Odd. It shows up in NS7.00/Win and NS7.1/Win.

Why are you using such an old version of Netscape?

¥åßßå, that doesn't provide a way to make it disappear if the user wants to continue using IE.

Pegasus
09-17-2006, 02:58 AM
I have no choice. I can't afford the price of OSX and there's no newer versions for OS9.2.2. I'll get there eventually, though. I'm going back to school next year, student-loan willing, so I'll be able to do some serious upgrading to my computer programmes.

Peg

Kravvitz
09-17-2006, 04:32 AM
MacOS X is expensive.

I suggest you take a look at iCab 3. (http://www.icab.de/)

¥åßßå
09-17-2006, 04:34 AM
<!--[if IE]>
<div style="position:absolute;left:50%;margin-left:-5em;border:2px dashed #f00;color:#400;background:#fcc;width:10em;text-align:center;padding:.5em">
<a href="http://www.mozilla.com/firefox/">Get firefox</a><br />
<button onclick="this.parentNode.style.display = 'none';">Close</button>
</div>
<![endif]-->
That does require js ;)

¥

ascskate
09-17-2006, 08:28 AM
its not working....

ascskate
09-17-2006, 08:42 AM
nvm. i got it to work, i ended up using the Java script version that you gave me, yabba


thanks so much.


here is what i ended up using.

<!--[if IE]>
<div style="position:absolute;left:40%;margin-left:-5em;border:2px solid #f00;color:#400;background:#fcc;width:300px;text-align:center;padding:.5em">
If you can see this, that means you are using Internet Explorer and that means you
need to download firefox. Firefox is a better all around browser and it is the browser that i chose to design my site around! so if you are experienceing any problems with my site, its probably from using IE!
<p>
<a href="http://www.mozilla.com/firefox/" target="_blank"><h2>GET FIREFOX!</h2></a>

<br />
<button onclick="this.parentNode.style.display = 'none';">Close</button>
</div>
<![endif]-->

you can see it here, www.ascskate.ueuo.com (using IE.........i know its terrible but people still use it or i wouldnt need this pop up in the first place. ;))

ascskate

¥åßßå
09-17-2006, 11:34 AM
The code you're using isn't valid (although only IE will see it), change it to this :-
<!--[if IE]>
<div style="position:absolute;left:40%;margin-left:-5em;border:2px solid #f00;color:#400;background:#fcc;width:300px;text-align:center;padding:.5em">
<p>If you can see this, that means you are using Interdebt Exploiter, and that means you need to download Firefox. Firefox is a better all round browser and it is the browser that I chose to design my site around! So, if you are experiencing any problems with my site, it's probably from using IE!<br />
<a href="http://www.mozilla.com/firefox/" onclick="window.open( this.href);return false;" style="font-size:140%">GET FIREFOX!</a></p>
<button onclick="this.parentNode.style.display = 'none';">Close</button>
</div>
<![endif]-->

¥

ascskate
09-17-2006, 11:35 AM
ok, thanks. ill change my code.

what makes this one validate and the other one not?
just wondering

i love the interdebt exploiter part ;)

¥åßßå
09-17-2006, 11:39 AM
you didn't close your <p> tag, <a> cannot contain <h2> and "target" is deprectated (in xhtml strict, although it's valid in html/xhtml transitional/frameset).

Ohh, and a few spelling errors, but I'm sure the validator would miss those ;)

¥

ascskate
09-17-2006, 11:40 AM
yes i always have typos, im kinda lazy when it comes to typing. :P

thanks for all your help yabba


ascskate

¥åßßå
09-17-2006, 11:41 AM
No problem ;)

¥

ascskate
09-18-2006, 03:24 PM
ok, i just thought of one bad thing about this, everytime someone goes back to the home page, if shows up again. is there a way to make it only pop up once per visit for each person

ascskate

ascskate
09-18-2006, 06:55 PM
*bump*



.

_Aerospace_Eng_
09-18-2006, 08:26 PM
You barely waited 3 hours. Don't bump when you don't have to. It more than often makes people NOT want to help you. You are going to have to use some type of cookie to store whether or not they have visited the site already. If not then show the div, if they have then don't show the div.

ascskate
09-18-2006, 09:04 PM
i know i didnt wait long enough. i just was really hyper today, well more liek a 5 year old on crack, and wanted an answer as soon as possible.

You are going to have to use some type of cookie to store whether or not they have visited the site already.

thats what i was thinking but im not sure how to do it...


ascskate

ascskate
09-23-2006, 09:48 AM
*bump*


ascskate