Is there a way to create a pop up exit with blogspot?

dragon77

Elite Member
Joined
Jan 18, 2009
Messages
1,615
Reaction score
953
Is there a way to create a pop up exit with blogspot?
 
Yep. In your dashboard click the 'layout' tab, and then 'edit html'. In between your <head> and </head> tags you need to add this code:
Code:
<script language='javascript'>
var exitpop = true;
function popup(){
	
if(exitpop==true) { window.open('http://www.google.com') }
}
</script>

And then you need to change your <body> tag to this:
<body onunload='popup()'>

'Save Template' and that's it :)

Whoops almost forgot to add:
Now if you don't want the popup to be triggered when a user clicks a particular link (ie and internal link on your blog), you need to select the 'Expand Widget Templates' checkbox, and manually edit each link to add 'onclick="exitpop=false"':
Code:
<a onclick='exitpop=false' ...

This can be tedious and time consuming, but is necessary if you dont want the popup to fire every time a surfer licks on one of your blog posts.
 
Last edited:
Great tips, It's good to know.
 
Won't blogger delete the blog for suspicious behavior? is this still work?
 
Back
Top