Read a Span Value From an iframe with JS/jquery

  • Status: Closed
  • Prize: $15
  • Entries Received: 10
  • Winner: pixahex

Contest Brief

Hi,

in my html page i have an iframe i want just read a span Value From an iframe

Thank you.

Recommended Skills

Employer Feedback

“Thank you.”

Profile image nicola5, Morocco.

Top entries from this contest

View More Entries

Public Clarification Board

  • thebollysl
    thebollysl
    • 5 years ago

    You can't read from iFrame, but if you use PHP/.NET to remotely fetch data! Most importanlty you can't bypass cross domain issue, it is totally restricted by browser, any javascript,code, script won't going to help you.

    • 5 years ago
    1. nicola5
      Contest Holder
      • 5 years ago

      yes, but i want read it with Jquery/Javascript how can i do it ?

      • 5 years ago
    2. pixahex
      pixahex
      • 5 years ago

      https://youtu.be/xfrjWfLkoxc
      here's how you do it.

      • 5 years ago
  • mostafaalsadawy
    mostafaalsadawy
    • 5 years ago

    I think this page might help you
    https://stackoverflow.com/questions/9393532/cross-domain-iframe-issue
    give me a sample of your code i'll give you a definitive answer .

    • 5 years ago
    1. nicola5
      Contest Holder
      • 5 years ago

      the iframe is not in my domaine and i don't have permision to get the iframe code

      • 5 years ago
  • saamer
    saamer
    • 5 years ago

    You can access of the value of iframe span with below mentioned code if it is of same domain. i.e. with this code :
    $('iframe').contents().find('#idofspan').html(); for html or
    $('iframe').contents().find('#idofspan').text(); for value
    But you cannot access the value if the iframe is of some other domain. You will get security error.

    • 5 years ago
    1. nicola5
      Contest Holder
      • 5 years ago

      i want baypass this security error by adedding same codes or insatting an extention chrome or firefox

      • 5 years ago
  • iamsinghkrishna
    iamsinghkrishna
    • 5 years ago

    Hi
    you can get the span value by span id or class, you can get span class value by bellow code -
    $('#id_frame').contents().find('.span_class').text();
    or if there is no class only id using then you can use bellow code..
    $('#id_frame').contents().find('#span_id').text();
    here #id_frame is iframe id you can also use iframe class here like .class_frame, please replace original class and id at the place of dummy id and class.
    thanks.

    • 5 years ago
    1. nicola5
      Contest Holder
      • 5 years ago

      i cannot access the value because the iframe is an other domain. i get security error.

      • 5 years ago
    2. nicola5
      Contest Holder
      • 5 years ago

      i want baypass this security error by adedding same codes or insatting an extention chrome or firefox

      • 5 years ago

Show more comments

How to get started with contests

  • Post your contest

    Post Your Contest Quick and easy

  • Get tons of entries

    Get Tons of Entries From around the world

  • Award the best entry

    Award the best entry Download the files - Easy!

Post a Contest Now or Join us Today!