Setting iframe base url

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

Here is what I am trying to do: I have a webpage with a URL field and a display area. The web application uses any URL that the user enters, and then uses a special proxy service to retrieve the web page specified by the user. I then present this webpage in the display area using an iframe, where I paste the html source code into the DOM from the iframe . I do not use the src attribute because I am trying to demonstrate the functionality of my proxy service, and I do not want the browser to directly display the page.

The html source that I am inserting will load in an iframe with one caveat. None of the images or other resources using the relative path name work because they link to the URL of my external web page as the base URL. For example, if my webpage is at www.me.com and the user is trying to download www.google.com , I can display the html source for www.google.com , but the main Google image does not load because the image is trying to load from www.me.com/image , not www.google.com/image .

+8
html iframe
source share
1 answer

At the end of the proxy, enter this tag:

<base href="http://pathtooriginalpage" />

and it must be done.

+8
source share

All Articles