javascript - User interest Search based on Profile -
i have
- user login page
- profile page
- search page (keywords entered here,results fetched , published using google)
i use javascript performing search , profile, login page created based on php have profile page user interests listed, doubt ,i need perform search based on user interest stored in profile page.
for example ,if search in google ex: "sun" ,the results related sun ,solar system ,planets ..
for instance in user interest ,there category "favorite news paper :" , answer "sun news report" ..so whenever user searches "sun" ..it should give high priority user interest rather general google search results
how can ,if there kind of code snippet there ,please me regarding concept.
its trick works fine @ myside. there 1 input text can take value db also..its choice. have call 1 function redirect google..this search on google watever have type in input text.. if want can append more string in want add category (news paper)
code:
<input type="text" name="search" id="search" style="width:400px;"/> <input type="button" name="searchbtn" id="searchbtn" value="search" onclick="searchlink()"/> <script language="javascript" type="text/javascript"> function searchlink() { var link1 = document.getelementbyid("search").value; window.location.href = 'https://www.google.co.in/#q='+link1; } </script>
example:
type 'facebook' in input redirect google facebook string.. if want add more details 'login' along 'facebook' can try like
function searchlink() { var link1 = document.getelementbyid("search").value; link1 = link1.replace(/ /g,"+")+"+login"; window.location.href = 'https://www.google.co.in/#q='+link1; }
hope right approach towards query..
edit
value db favrt sport & can hide if user must not see it..
<input type="text" name="search" id="search" value=" *here db* "/> <input type="button" name="searchbtn" id="searchbtn" value="search" onclick="searchlink()"/> <script language="javascript" type="text/javascript"> function searchlink() { var link1 = document.getelementbyid("search").value; // here watever sport in variable link1 link1 = link1.replace(/ /g,"+")+"+sport"; // apend 'sport' here, can change according need window.location.href = 'https://www.google.co.in/#q='+link1 } </script>
Comments
Post a Comment