Q: Appending iframe with correct url I want to load an iframe this is what I have done
document.getElementsByName('iFrameName')[0].src = url;

but it is appending the url of the file to the current url e.g.
www.website.com/currentpage
so instead of the url to be www.website.com/file.html
it is now www.website.com/currentpage/file.html
How can I go about what I want

A: You can try with Jquery instead of javascript.  use the below code to set attributes in an iframe.
$('iframeName').attr('src', 'url');

if you want to load the iframe use the load method.
$('iframeId').load('currentPageUrl.html #iframeId');


A: Use the setAttribute function to set the 'src' attribute with its value;
Refernce Set Attribute also see the examples over there.
Element.setAttribute(name, value);
