object-tag

How can I dynamically add an <object> tag with JavaScript in IE?

跟風遠走 提交于 2019-12-29 05:35:16
问题 I have to add either an embed tag for Firefox or an object tag for Internet Explorer with JavaScript to address the appropriate ActiveX / Plugin depending on the browser. The plugin could be missing and needs to get downloaded in this case. The dynamically added embed tag for Firefox works as expected. The dynamically added object tag for Internet Explorer seems to do nothing at all. The object tag needs the following attributes to function properly. id ="SomeId" classid = "CLSID:{GUID}"

postMessage into object tag

杀马特。学长 韩版系。学妹 提交于 2019-12-23 04:38:06
问题 I am trying to get the html inside an object respond to my postMessage, but I am unable to get the referencing correct. I've tried var object = $("#test_object").get(0).contentWindow; object.postMessage("run","*"); which works for iframe. But as i am determined to use the object tag. Is there a way to pass the postMessage through? 回答1: No, postMessage works only for iframes and windows/tabs. 来源: https://stackoverflow.com/questions/13830884/postmessage-into-object-tag

Read data in HTML object tag

半城伤御伤魂 提交于 2019-12-21 04:56:15
问题 I have a text file stored on the server and an object in HTML like this: <object id="data" type="text/plain" data="test.txt"></object> How can I read the contents of test.txt in Javascript? What I have so far is: var data = document.getElementByID("data"); But I can't figure out how to read the HTML document inside the object tag. 回答1: The object tag has to make a separate request to the server and then load that content. Meanwhile, your JavaScript has already executed and "misses the bus."

Does Internet Explorer remove the <object> element from DOM?

坚强是说给别人听的谎言 提交于 2019-12-13 03:16:20
问题 I have markup in my page that includes the tag: <body> <object codebase="blah" codetype="text/blah"> <param name="name" value="value"/> <div>Some Markup</div> </object> </body> The idea is for browsers to display the content of the <div> by default, but if a special JS library is present, it will find all the elements and transform the ones it cares about (based on @codetype ). This works in Firefox and WebKit, but fails in IE, because that browser seems to strip off the outer <object>

loading elements with <object> tag in HtmlUnit

时间秒杀一切 提交于 2019-12-12 02:17:30
问题 I am loading a webpage which has lots of flash/gif elements embedded within object tags. I can see those elements in my browser, but I cannot reach them in HtmlUnit. page.getByXPath("//object"); //gives empty result waitForBackgroundJavaScript() doesn't help either. Anyone had the same problem before? Thanks!! 来源: https://stackoverflow.com/questions/23661147/loading-elements-with-object-tag-in-htmlunit

Is it possible to change the file path of the video using javascript?

戏子无情 提交于 2019-12-11 16:19:57
问题 I have an object tag in a HTML file: <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> <param name="FileName" value="../ABC/WildLife.wmv" id="mediaPlayerFile"> <param name="AutoStart" value="false" /> </object> I want to change the filename using javascript. What I have so far is this: <script type="text/javascript"> function disp_current_directory() { var val = document.getElementById('mediaPlayerFile'); val.attributes['value'].value = "D:\XYZ\WildLife.wmv"; } </script> But this

jQuery SVG-object tag load event

核能气质少年 提交于 2019-12-10 12:44:20
问题 I have a page which dynamically adds SVGs to the page via jQuery: grid.append($('<object>') .load(function () { // do stuff alert('loaded') }) .attr({ id: 'tile', type: 'image/svg+xml', width: Math.round(tile_w), height: Math.round(tile_h), data: 'map/base.svg' }) ); I need access to the SVG document (to "push" a variable into the svg script context) but the SVG has to be loaded for that. My problem is that I dont get the load event working. No alert is displayed. How to do? Edit: It seems

contents() in <object type=“text/html”></object>?

非 Y 不嫁゛ 提交于 2019-12-06 05:57:36
问题 I can access local contents loaded in an <iframe> with $("#frame").contents().find('div').css(...) When using a <object type="text/html"> instead (same local site), the contents function does not work. Is there another way or did I miss something ? Here follows the test code: HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link type="text/css" href="css/style.css" rel="stylesheet"/> <script type="text/javascript" src=

contents() in <object type=“text/html”></object>?

為{幸葍}努か 提交于 2019-12-04 11:34:39
I can access local contents loaded in an <iframe> with $("#frame").contents().find('div').css(...) When using a <object type="text/html"> instead (same local site), the contents function does not work. Is there another way or did I miss something ? Here follows the test code: HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link type="text/css" href="css/style.css" rel="stylesheet"/> <script type="text/javascript" src="js/jquery-1.3.2-min.js"></script> <script type="text/javascript" src="js/try.js"></script> </head>

Read data in HTML object tag

心不动则不痛 提交于 2019-12-03 15:22:54
I have a text file stored on the server and an object in HTML like this: <object id="data" type="text/plain" data="test.txt"></object> How can I read the contents of test.txt in Javascript? What I have so far is: var data = document.getElementByID("data"); But I can't figure out how to read the HTML document inside the object tag. The object tag has to make a separate request to the server and then load that content. Meanwhile, your JavaScript has already executed and "misses the bus." Run your code inside the onload event of the object . Then use .contentDocument.body.childNodes[0].innerHTML