question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

modify data attribute dynamically of object tag not working

See original GitHub issue
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta charset="utf-8" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
        <script>
            $(document).ready(function () {
                $('#doc').prop('data', 'anotherDocument.pdf');
            });
        </script>
    </head>
    <body>
        <object id="doc" type="application/pdf" data="document.pdf" width="500px" height="500px"></object>
    </body>
</html>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jhasselkuscommented, Aug 5, 2016

Here’s a simple example that reproduces the problem on Edge 38.14393.0.0, EdgeHTML 14.14393:

Plunkr

<!DOCTYPE html>
<html>
  <head>
    <script data-require="jquery@*" data-semver="3.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>
    <script>
        $(document).ready(function () {
          $('#pdfObj').prop('data', 'http://www.pdf995.com/samples/pdf.pdf');
        });
    </script>
  </head>
  <body>
    <h1>PDF viewer</h1>
      <object id="pdfObj" data="" type="application/pdf" width="500px" height="500px">
        <p>This browser doesn't support object</p>
      </object>
  </body>
</html>

The Plunkr properly displays the PDF file on Chrome and FF, but on Edge the object element stays blank.

0reactions
dilijevcommented, Nov 15, 2016

Duplicate of #881

Read more comments on GitHub >

github_iconTop Results From Across the Web

data attribute of object tag in html is not updating the new url
Issue: I am trying to update the data ...
Read more >
Changing <object> tag element's data property dynamically
Hi All, I am looking for a way to change and load a HTTP resource in a element. I have code like the...
Read more >
HTMLElement.dataset - Web APIs | MDN
An HTML data-* attribute and its corresponding DOM dataset.property modify their shared name according to where they are read or written:.
Read more >
<OBJECT> tag doesn't reload after change DATA param.
What steps will reproduce the problem? 1. Download the attachments to a folder; 2. Open main.html; 3. Click on button ' ...
Read more >
How to specify URL of resource to be used by the object in ...
It can be done by setting the data attribute to the specified URL in the <object> tag. Syntax: <object data="URL">. Possible Values.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found