Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning a URL to populate the URL text field 1

Status
Not open for further replies.

bipinshakya

Programmer
Feb 12, 2011
1
GB
Our user is using our ASP.NET application in a browser window. One of the fields he needs to fill in is the URL of a page from another site, which is found by searching the Internet using any of a variety of search engines.

We can launch a new window to browse the Internet, but how can we get the URL of the page that is found at the end of the search process. Ideally we want to launch a new window from a ‘browse’ button alongside a field on our originating ASP page, and when the child window is closed, the last URL is available to the originating ASP page to use in the field.

Is this possible, and if so, how?

If not possible, does anyone have any clever ideas (other than a straight cut-and-paste) for getting the URL back into the originating application?

P.S. We ideally need a solution that will work across different types of browser (e.g. IE, Firefox, Safari, Chrome)
 
the brute force method would be screen scraping the results, but that is messy and very fragile.

I believe search engines have an API you can call to return search results. I would imagine the data is in json format. this would be a better approach, but it means they would be searching with a set list of engines you define.

another option: have the user open a tab/window/dialog, the user searches for the site. the user visits the site. the user returns to the "main" page and clicks a button to capture of the window.location of the child window, but the text in the textbox and closes the child window.

all this said, it would be coded on the client using js. so your server language, in this case .net, doesn't matter. asp.net doesn't know about the child window, searching or anything else. it just knows there is a textbox with a url in it. how it got there doesn't matter.

using a js library like jquery will allow the code to work across all browsers.

I would solve it like this
1. open a child tab/window/modal from the parent window
2. user searches and visits the page in the child tab
3. user returns to parent tab and clicks another button "capture url" which would set the textbox value = childwindows.location. and close the window.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top