0

Is it possible to type in a web url and display it on an element in the page?

I am doing an html project. What I wanted is create a page with a display area where the website to be searched can be viewed. As in a web browser- typing in the url and display it. First the user types in a url and then the webpage is showed on the screen and not in the browser. This project is somewhat similar to a browser.

10th Apr 2020, 4:13 AM
NightSkyLeaf
NightSkyLeaf - avatar
6 Respuestas
+ 3
iframe document.getElementsByTagName("iframe")[0].src = document.getElementsByTagName("input")[0].value; https://code.sololearn.com/WAI9PAU3Nz90/?ref=app
10th Apr 2020, 4:16 AM
Gordon
Gordon - avatar
+ 2
Carefully look at this: getElementById getElementsByTagName getElementsByClassName What's in common? What's the difference ? first get 'element' (singular), seconds get 'elements' (plural)... The first return a single element, while both two others return an array-like list of elements (nodes collections): you must access elements from the collection by an index ;) So the fix is: replace getElementsByTagName() by getElementsByTagName()[0] (in left and right hand of the assignation of input value to iframe src in your onclick event handler ;)
10th Apr 2020, 12:49 PM
visph
visph - avatar
11th Apr 2020, 2:33 AM
narayanaprasad
narayanaprasad - avatar
+ 2
🤗
11th Apr 2020, 4:43 AM
narayanaprasad
narayanaprasad - avatar
+ 1
Be aware that some websites prevents to use their pages not at the top level window (embeded in another domain) ^^
10th Apr 2020, 6:17 AM
visph
visph - avatar
0
Thanks. is it possible to use it with python?
10th Apr 2020, 4:26 AM
NightSkyLeaf
NightSkyLeaf - avatar