简体   繁体   中英

Show external website in my aspx page and include own javascript

What I am trying to accomplish: A visitor of my website should be able to load an external website into my website and click elements on this external websites to retrieve the XPath of the element. Like Firebug but completly online.

I have already managed to create a piece of javascript to click elements on MY website and return the XPath of the element.

Now I need to know how to show an external website in my ASP.NET WebForms page and inject my own javascript.

I tried to use a literal control and download the external website's HTML code with a WebClient.

WebClient webClient = new WebClient();
string result = webClient.DownloadString(txtURL.Text);

litWebsite.Text = result;

Problem here is: The the external website's design will be broken if I don't consider the CSS references. Maybe this is a complete wrong approach.

Any ideas?

Thank you!

I'm not sure it's possible.

Sure, you could display the web page via iframe but unless you owned the content, I'm not sure you can control it with your own javascript.

Maybe I'm wrong but I've always heard that your could do very little with other web content in your own project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM