Write current url in an iframe by javascript

Discussion in 'JavaScript' started by rakibtg, Jul 27, 2012.

  1. #1
    I am trying to write current website url in a frame using javascript. Butt my methods does not working... What I want to do is to write the current url path into this code instead of "CURRENT+WEBSITE+URL+HERE" text.

    My current iframe code:
    <iframe allowtransparency='true' frameborder='0' height='600px' id='web search' marginheight='0' marginwidth='0' scrolling='no' src='http://mysite.com/display?sid=1770469&title_color=0000FF&text_color=000000&background_color=FFFFFF&border_color=FFFFFF&url_color=000000&url=CURRENT+WEBSITE+URL+HERE&b=4' title='Find It' width='160px'></iframe>
    Code (markup):
    In the iframe url src you will get "CURRENT+WEBSITE+URL+HERE" text where I want to put the current URL, so assuming a path of that site is "http://mysite.com/go/went/gone.html" , the iframe will show this url:
    http://mysite.com/display?sid=1770469&title_color=0000FF&text_color=000000&background_color=FFFFFF&border_color=FFFFFF&url_color=000000&url=http://mysite.com/go/went/gone.html&b=4' title='Find It' width='160px
    Code (markup):
    if i want to say it more clearly then: i just want to put that page URL which will have that iframe, and i wanna put that page address/URL instead of "CURRENT+WEBSITE+URL+HERE" , so it is not the iframe URL it is that page URL which will bear that iframe. Suppose i have put this iframe in http://example.com/test.html so that the frame URL should like this:
    http://mysite.com/display?sid=1770469&title_color=0000FF&text_color=000000&background_color=FFFFFF&border_color=FFFFFF&url_color=000000&url=http://example.com/test.html&b=4
    Code (markup):
    see in &url= in this address.. any idea?
    :cool:
    It would me much better for me if you would code it, will help me a lot. Thanks
     
    rakibtg, Jul 27, 2012 IP