|
|
#1 |
|
New Member
![]() Join Date: Mar 2011
Posts: 23
|
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! |
|
|
|
|
|
#2 |
|
Gold Member
![]() Join Date: Mar 2010
Location: Auckland, New Zealand
Posts: 326
|
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. |
|
|
|
|
|
#3 |
|
New Member
![]() Join Date: Mar 2011
Posts: 23
|
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! |
|
|
|
|
|
#4 |
|
New Member
![]() Join Date: Mar 2011
Posts: 23
|
Is there anyone that can point me in the right direction with this? I would appreciate it hugely.
|
|
|
|
|
|
#5 |
|
Gold Member
![]() Join Date: Mar 2010
Location: Auckland, New Zealand
Posts: 326
|
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> |
|
|
|
|
|
#6 |
|
New Member
![]() Join Date: Mar 2011
Posts: 23
|
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! |
|
|
|
|
|
#7 |
|
New Member
![]() Join Date: Mar 2011
Posts: 23
|
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. |
|
|
|
|
|
#9 |
|
New Member
![]() Join Date: Mar 2011
Posts: 23
|
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.
|
|
|
|
|
|
#10 |
|
Gold Member
![]() Join Date: Feb 2011
Location: Australia
Posts: 369
|
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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|