Web Design Forum  
 
Go Back   Web Design Forum > Web and Graphic Design > Web Design

Reply
 
LinkBack Thread Tools Display Modes
Old 03-13-2011, 03:56 PM   #1
New Member
 
Join Date: Mar 2011
Posts: 23
Default Search between two sites

Hi guys, does any one know if it is possible to set up a search box on one website that, once submitted, can automatically redirect a visitor to another website to display the search results?

Thanks in advance guys!
Brody is offline   Reply With Quote


Old 03-13-2011, 07:39 PM   #2
Gold Member
 
leroy30's Avatar
 
Join Date: Mar 2010
Location: Auckland, New Zealand
Posts: 326
Default

Certainly.

How does the search work on the second website? Do you own or have priviledge access to the second website?

You could, for example, make the search on website two work from keywords in the query string so when you link from website 1 you just copy the keywords in to the link address.

Here's an example:
http://www.google.co.nz/#hl=en&sourc...d9f6fff176994b

Notice how in the link there is a querystring variable 'q' that has a valuye of 'Querystring+keywords'. This would be the simplest setup in my opinion.
__________________
DVI web design | Portable Time Clock
leroy30 is offline   Reply With Quote
Old 03-13-2011, 08:47 PM   #3
New Member
 
Join Date: Mar 2011
Posts: 23
Default

Hi leroy30, thanks for replying, very much appreciated!

I do have permission to use both sites, i'm trying to put a search box on a fan page that redirects the visitor to the main website to display the search results.

Here's the fan page:

http://www.facebook.com/WickedGadget...89786571060070

Here's the website I'm trying to redirect to:

http://www.wickedgadget.com

Here's the code I'm using for the search box on the fan page, it now includes the 'Query+keywords' but unfortunately this didn't work:

<form action="http://www.wickedgadget.com/search,b.html?q=Query+keywords" method="post" target="_blank" >
<input type="text" class="box" /><br /><br />
<input name="submit" type="image" src="images/send.jpg" />
<br /><br />
</form>

I'd greatly appreciate it if you could tell me where I'm going wrong!
Brody is offline   Reply With Quote
Old 03-14-2011, 05:41 PM   #4
New Member
 
Join Date: Mar 2011
Posts: 23
Default

Is there anyone that can point me in the right direction with this? I would appreciate it hugely.
Brody is offline   Reply With Quote
Old 03-14-2011, 07:44 PM   #5
Gold Member
 
leroy30's Avatar
 
Join Date: Mar 2010
Location: Auckland, New Zealand
Posts: 326
Default

Make your button a link... You're trying to post back to that page (i think, by the looks of it) but it probably won't let you do that.

Make a link or a javascript button to redirect to that url. For example...

<input id="search" type="text" class="box" />
<div class="button" onclick="searchredirect();"></div>

<script type="text/javascript">

function searchredirect() {

location.href = "http://www.wickedgadget.com/search,b.html?q=" + document.getElementById('search').value;

};

</script>
__________________
DVI web design | Portable Time Clock
leroy30 is offline   Reply With Quote


Old 03-14-2011, 08:30 PM   #6
New Member
 
Join Date: Mar 2011
Posts: 23
Default

Thanks again leroy30, your help has got me very close to achieving the desired result, I really appreciate your help.

It all works just the way I want but I just need the new page to open in a new window rather than in the fan page iframe. Is this possible at all?

Thanks again, you've been really helpful!
Brody is offline   Reply With Quote
Old 03-14-2011, 09:16 PM   #7
New Member
 
Join Date: Mar 2011
Posts: 23
Default

Hi Leroy30, just to keep you updated, I have now added window.parent. to the beginning of location.href so it says:

window.parent.location.href = "http://www.wickedgadget.com/search,b.html?q=" + document.getElementById('search').value;

So it now opens in the same window. This is a good temporary fix but is it possible to have it open in a new window? using 'blank' in the place of 'parent' doesnt seem to work.
Brody is offline   Reply With Quote
Old 03-14-2011, 09:27 PM   #8
Gold Member
 
Join Date: Feb 2011
Location: Australia
Posts: 369
Default

Look at THIS site for information about opening a new window with javascript. Be careful though because some methods trigger popup blockers.

Hope that helps.

Last edited by DHDdirect; 03-14-2011 at 09:29 PM.
DHDdirect is offline   Reply With Quote
Old 03-14-2011, 09:44 PM   #9
New Member
 
Join Date: Mar 2011
Posts: 23
Default

Thanks for that, I found that site on my travels earlier, I'm a complete noob in javascript and I couldn't figure out how to have two onclick functions going at the same time, one seemed to cancel out the other.
Brody is offline   Reply With Quote
Old 03-14-2011, 10:14 PM   #10
Gold Member
 
Join Date: Feb 2011
Location: Australia
Posts: 369
Default

Sorry Brody, I should have been more clear. It's the window.open() method that you want to focus on. It states that a new window will open where the window.parent is obviously in the same browsing window.

THIS will explain all it's attributes.
DHDdirect is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:47 PM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.