Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6889045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:06:23+00:00 2026-05-27T06:06:23+00:00

My html has an extension which embeded by other application: document.documentElement.appendChild((function () { var

  • 0

My html has an extension which embeded by other application:

document.documentElement.appendChild((function () {
    var objectElement = document.createElement("embed");
    objectElement.setAttribute("id", "my-plugin");
    objectElement.setAttribute("type", "application/x-my-app");
    objectElement.setAttribute("width", "0");
    objectElement.setAttribute("height", "0");
    return objectElement;
}()));

Normally we get this object by its id: var plugin = document.getElementById("my-plugin");

The problem here is, the object is injected by other apps and its ID could vary. I only know its MIME type is “x-my-app”, but looks like there is no getElementByType() to get it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:06:23+00:00Added an answer on May 27, 2026 at 6:06 am

    On sufficiently advanced browsers you can use querySelector()/querySelectorAll():

    document.querySelector("embed[type='application/x-my-app']")
    

    If using jQuery, the following will work even on less sufficiently advanced browsers:

    $("embed[type='application/x-my-app']")
    

    If neither, you can loop over all the <embed> tags:

    result = [];
    var embeds = document.getElementsByTagName('embed');
    for (var i = 0; i < embeds.length; i++) {
        var embed = embeds[i];
        if (embed.type === type) {
            result.push(embed);
        }
    }
    

    jsFiddle example of all three.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My HTML has cell = document.createElement(td); cell.appendChild(document.createTextNode(contents)); cell.setAttribute('width', '100'); The following syntax is not
I am creating an google-chrome-extension which has html notifications. There will be a close
I currently have this in my document $(document).ready(function(){ $([href$='.html']).addClass('html'); $([href$='.pdf']).addClass('pdf'); }); which styles any
Okay, I'm building an extension like so: has a browseraction which invokes a popup.html
There was an Html.RadioButtonList extension method in ASP.NET MVC Futures. Has anyone found a
I've created a MVC extension to auto apply attributes to html inputs. Which is
HTML has an input button type to reset all fields in a form to
I'm new to HTML coding and I know HTML has some reserved characters for
My output for my table in HTML has several columns such as userid, name,
Does the IFRAME's onload event fire when the HTML has fully downloaded, or only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.