问题标签 [object-tag]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
106 浏览

javascript - Javascript SVG 交互问题

我正在尝试开发交互式 SVG 地图,当鼠标进入 SVG 图像中的矩形时,我想做一些事情。目前,当我的鼠标进入 SVG 图像时,代码会记录到控制台,但当我将鼠标悬停在矩形上时不会。任何帮助将非常感激。谢谢!

0 投票
1 回答
444 浏览

html - (缺点)嵌入 HTML 页眉/页脚的优点 tags?

I am looking for a simple way to make my website modular and extract common parts that appear often like header and footer into separate files.

In my case, I can not use any server-side includes

I am looking for a simple way to make my website modular and extract common parts that appear often like header and footer into separate files.

In my case, I can not use any server-side includes with e.g. PHP. I also generally would like to avoid including big libraries like JQuery just for such a simple task.

Now I came across https://stackoverflow.com/a/691059/4464570 which suggests to simply use an HTML <object> tag to include another HTML file into a page, like this:

I might be missing something important here, but to me this way seems to perfectly fit my needs. It is very short and precise, the <object> tag is well supported by all browsers, I don't need to include any big libraries and actually I don't even need any JavaScript, which allows users blocking that to still view the correct page structure and layout.

So are there any disadvantages I'm currently not aware of yet with this approach? The main reason for my doubts is that out of dozens of answers on how to include HTML fragments, only one recommended <object> while all others went for a PHP or JavaScript/JQuery way.

Furthermore, do I have to pay attention to anything special regarding how to put the <object> tag into my main page, or regarding the structure of the file I want to include this way? Like, may the embedded file be a complete HTML document with <!DOCTYPE>, <html>, <head> and <body> or should/must I strip all those structures and leave only the inner HTML elements? Is there anything special about using JavaScript or CSS inside HTML embedded this way?


The use of the <object> tag for HTML content is very similar to the use of an <iframe>. Both just load a webpage as a seperate document inside a frame that itself is the child of your main document.

Frames used to be very popular in the early days of web development, then in the form of the <frame> tag. They are generally frowned upon, however, and you should really use them as little as possible.

Why not to use this technique for displaying your own content

The HTML content in the child frame cannot communicate with the parent. For example, you can't use a script in the parent HTML to communicate with the child and vice versa. That makes it not very useful for serving your own content when you want to display anything but static text.

Why not to use this technique for displaying someone else's content

You can't use it to serve a lot of external content either. Many websites (including eg. SO) send an X-Frame-Options header along with their webpage that has the value SAMEORIGIN. This prevents your content from being loaded and displayed.

0 投票
0 回答
70 浏览

javascript - 编辑来自跨源源的对象内的 SVG

我正在尝试执行此代码...

我正在尝试对 ojbect 标签内的 SVG 强制设置“100%”的宽度。
尽管该代码在“本地主机”上工作,但由于“跨源”安全问题,它在服务器上不起作用。

未捕获的 DOMException:无法从“HTMLObjectElement”读取“contentDocument”属性:阻止具有源“ http://www.example.org ”的框架访问跨域框架

我的搜索导致使用window.postMessage,但在这种情况下我无法理解如何使用它。

任何帮助将不胜感激。

0 投票
1 回答
2090 浏览

html - 样式化对象/嵌入的内容

我正在开发一个小型 Web 应用程序,其中有一个用于显示小文档的object元素(包含一个)。embed

这些文档可以是 PDF 或纯文本文件 (.txt),它们是我从 Web 服务以 base64 字符串的形式获得的。然后,为了显示内容,我分别更新和的datasrc属性。最终结果看起来像这样(简化):objectembed

所有的 PDF 看起来都不错(浏览器使用插件加载它们),但我在处理文本文件时遇到了一些问题。.txt 的内容显示正确,但文本看起来有点小,我被要求将其放大。

我尝试更改的字体大小,objectembed内容不受它的影响:

在 Chrome 中,我看到该对象的内容是一个 #document,它以 .txt 格式显示 base64 .txt 的内容pre。所以我尝试设置样式pre,但只有pre标签外的object标签才能使用它们,而不是它里面的标签:

object是否可以为/的内容赋予样式embed?怎么可能做到?

0 投票
0 回答
38 浏览

asp.net - 如何在浏览器中查看 Windows 窗体应用程序?

我有一个 Windows 应用程序,我进一步.dll使用控制库项目将其转换为文件。

现在我希望能够使用.html页面在网站上托管控件。我使用了以下链接,但在浏览器中查看控件时仍然存在问题。

站点2

站点3

我试图写<object>在site2中看到的标签,我认为这就是我的问题开始的地方。包含 HTML 文档和.dll文件的文件夹位于C:\Users\MyUserName\Documents\TheFolder. 那么如何将其转换为包含“site2”中所见的“localhost”链接?

另外,如何找到更改我的安全策略的路由(控制面板>管理工具>.net框架配置>配置代码访问安全策略>调整区域安全),因为当我找不到“.net框架配置”时导航到“管理工具”。

0 投票
1 回答
686 浏览

javascript - 使用 javascript 使用 SVG 代码填充对象标签

我确实有可用的 svg 代码作为 javascript 变量中的文本。我需要将其设置为对象标签(不是 SVG 或 IMG)中的图像。这可能吗?

这在使用缓存的 SVG 代码创建 SVG 对象标签中进行了讨论,但没有任何响应。

0 投票
1 回答
166 浏览

fullscreen - 全屏不适用于对象标签

我使用了 fullscreen.js 当我使用 iframe 时它在所有平台上都可以正常工作,但 iframe 在 iphone 上无法正常工作,它会自动放大。然后我尝试了对象标记,它在所有平台上都可以正常工作,但现在我的全屏按钮不起作用。我也添加了 allowfullscreen 但什么也没做

0 投票
0 回答
97 浏览

html - HTML 指针事件中的 SVG 对象

如果通过标签对一些 SVG 进行分层object,最上面的一个总是消耗所有看起来的鼠标事件。

pointer-events: auto这与 SVG 的默认值相矛盾。

pointer-events我通过设置它的 SVG DOM中的object元素和元素尝试了一堆解决方法contentDocument,但它的行为就像object只是一个矩形区域,尽管大部分是透明的 SVG 内容。仅应用于pointer-events: noneobject效果,它会禁用与 SVG 内容的任何交互。

为什么会这样,可以做些什么?

将 SVG 合并到单个svg标签中不是一种选择,因为它们使用重叠的命名空间。

0 投票
0 回答
261 浏览

cross-browser - 当我在 HTML5 视频标签中使用它时,对象标签不起作用?

我有需要显示视频的网页,但我将有两个文件

1) 带有 Theora 编解码器的 .ogg 文件

2) 带有 MPEG4 编解码器的 .mp4 文件

我在 HTML 下面写了,但它在 IE 和 Microsoft Edge 中没有像我预期的那样工作。

小伙伴们请弄清楚我哪里出错了?

0 投票
1 回答
565 浏览

javascript - 隐藏一个元素 tag with JavaScript

I want to hide an element inside an <object> tag , the element is <div class="footer">...</div> I tried this code but still not working, please help me

<

I want to hide an element inside an <object> tag , the element is <div class="footer">...</div> I tried this code but still not working, please help me

and this is my javascript code


ERROR: In NavArgument, unable to find attribute type

I'm trying to integrate these libraries into my Android project to make a navigation controller. When I add in these two lines to my build.gradle -

implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha01' implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha01'

It syncs ok, but in build I get this error:

ERROR: In NavArgument, unable to find attribute type.

I was able to build Google's sample project that uses the relevant libraries without problems.

My project has:

  • androidSupportLibrary 27.1.1
  • projectTargetVersion 27
  • projectCompileSdkVersion android-P
  • projectBuildToolsVersion 27.0.2
  • gradleVersion 3.0.1
  • gradlePlugin 4.4

I've already tried upgrading all these versions^, doing a clean build, restarting Android Studio, etc.

I also get some Java compiler errors.

Any thoughts on why this might happen?