javascript for adding search provider in IE7

Z

zhengyan11

Hey,

I encounter a problem when I am trying to add a pop up window on
my page, which will trigger a function
window.external.addSearchProvider(URL). This function will open a
dialog box window.


This pop up window only comes up when a user's browser is IE7 AND
he is a first-time visitor. My problem is how I can recognize a person
as a first-time visitor. I suppose that I should use a cookie. But I
am confused how I could get those useful info, which I will use to
define a first time visitor: in IE7 enviroment, I need to tell if this
user ever closes the dialog box window and if this user ever
manipulates this dialog box window. I need those info to set up a
cookie so that I could tell if a user is a come-back visitor and then
I could decide if I should trigger this pop up window again.

This is very urgent and I am a newbie to javascript. Please help!
thank you very much!
 
V

VK


"Hi" to you too ;-)
I encounter a problem when I am trying to add a pop up window on
my page, which will trigger a function
window.external.addSearchProvider(URL).

microsoft.public.scripting.jscript may be more helpful place to ask
for IE-specific programming.
From the common cookie usage point of view you are over-complicating
the matter.

1. User comes to your site.
2. You check if your search provider is already added - because by
some accasion user might already have your search engine because it is
so cool and famous :)
3. If not then you check if it was already proposed to this visitor to
add your search provider.
4. If both 2 and 3 are false then mark "proposition was made" by using
cookie and then make the proposition itself.

if ( (!window.external.IsSearchProviderInstalled(YourURL) &&
(/* YourGetCookieSub reports false */) ) {

/* YourSetCookieSub call */;

window.external.addSearchProvider(YourURL);

}
 
Z

zhengyan11

thanks a lot, VK:)

My js function still has trouble running. I wrote it as below:

if(isTargetPerson)
{
searchWindow =
window.open('mypic.gif','searchWindow','toolbar=no,resizable=no,width=180,height=85')
searchWindow.attachEvent('onClose', markVisit)
searchWindow.attachEvent('onClick', addSearchProvider)
searchWindow.focus()
}

I could get a popo up window when I visit the site, but the problem
is that when I click the pop up window, it could trigger nothing. I
wonder if there is something wrong with the attachEvent method. I am
lookking foward to reading your hints. thank you again.
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top