I have included Object/Embed in HTML-file of application to display another web page. ie
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>PhoneGap</title>
<link rel="stylesheet" href="master.css" type="text/css">
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="main.js"></script>
</head>
<body onload="init();">
<!-- <embed id='embadedContent' height = 400 width= '100%' src="http://192.168.2.44:9191/testtwo/"/> -->
<object height = 400 width= '100%' data="http://192.168.2.44:9191/testtwo/">
<param name="quality" value="high">
</object>
</body>
</html>
Now, I want to get reference of components which are in Webpage ( http://192.168.2.44:9191/testtwo/
) like button, textfield, etc. so that based on logic I can change property of these elements.
You can't, thanks to the Same Origin Policy . The origin of your page ( http://localhost:9191
) is different from the origin of the embedded page *( http://192.168.2.44:9191/testtwo/
).
Use the id
tag to later refere to the element, eg like this: id="myObject1"
<object id="myObject1" height = 400 width= '100%' data="http://192.168.2.44:9191/testtwo/">
<param name="quality" value="high">
</object>
And then you can access it via JavaScript:
var myObject1 = document.getElementById("myObject1")
myObject1.style.height = "200px"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.