By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,822 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,822 IT Pros & Developers. It's quick & easy.

javascript for adding search provider in IE7

P: n/a
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!

Feb 12 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
VK
On Feb 12, 7:55 pm, zhengya...@gmail.com wrote:
Hey,
"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(YourUR L) &&
(/* YourGetCookieSub reports false */) ) {

/* YourSetCookieSub call */;

window.external.addSearchProvider(YourURL);

}
Feb 12 '07 #2

P: n/a
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.
On Feb 12, 3:46 pm, "VK" <schools_r...@yahoo.comwrote:
On Feb 12, 7:55 pm, zhengya...@gmail.com wrote:
Hey,

"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(YourUR L) &&
(/* YourGetCookieSub reports false */) ) {

/* YourSetCookieSub call */;

window.external.addSearchProvider(YourURL);

}- Hide quoted text -

- Show quoted text -

Feb 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.