Setting base URL path of iframe

Viewed 12825

Is there any possible way (html, js, jquery) to change the base URL path of an iframe?

Here's what I'm trying to do: I have a webpage that has a URL-entry field and a display area. The web app takes whatever URL the user enters, and then uses a special proxy service to retrieve the webpage that the user has specified. I then render this webpage in the display area using an iframe, where I insert the html source code into the DOM of the iframe. I do not use the src attribute because I am trying to demonstrate the functionality of my proxy service, and I don't want the browser to directly render the page itself.

The html source that I insert will load in the iframe, with one caveat. None of the images or other resources that use a relative pathname work because they reference the URL of my outer webpage as the base URL. For example, if my webpage is located at www.me.com and the user tries to load www.google.com, I can render the html source for www.google.com, but the main Google image does not load because the image tries to load from www.me.com/image rather than www.google.com/image.

1 Answers
Related