Read a Span Value From an iframe with JS/jquery

  • สถานะ: Closed
  • รางวัล: $15
  • ผลงานที่ได้รับ: 10
  • ผู้ชนะ: pixahex

รายละเอียดการประกวด

Hi,

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

Thank you.

ทักษะแนะนำ

คำติชมจากผู้ว่าจ้าง

“Thank you.”

รูปประจำตัว nicola5, Morocco.

ผลงานอันดับสูงสุดจากการประกวดนี้

ดูรายการเพิ่มเติม

กระดานประกาศ

  • thebollysl
    thebollysl
    • 5 ปี ที่ผ่านมา

    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 ปี ที่ผ่านมา
    1. nicola5
      ผู้จัดการประกวด
      • 5 ปี ที่ผ่านมา

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

      • 5 ปี ที่ผ่านมา
    2. pixahex
      pixahex
      • 5 ปี ที่ผ่านมา

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

      • 5 ปี ที่ผ่านมา
  • mostafaalsadawy
    mostafaalsadawy
    • 5 ปี ที่ผ่านมา

    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 ปี ที่ผ่านมา
    1. nicola5
      ผู้จัดการประกวด
      • 5 ปี ที่ผ่านมา

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

      • 5 ปี ที่ผ่านมา
  • saamer
    saamer
    • 5 ปี ที่ผ่านมา

    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 ปี ที่ผ่านมา
    1. nicola5
      ผู้จัดการประกวด
      • 5 ปี ที่ผ่านมา

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

      • 5 ปี ที่ผ่านมา
  • iamsinghkrishna
    iamsinghkrishna
    • 5 ปี ที่ผ่านมา

    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 ปี ที่ผ่านมา
    1. nicola5
      ผู้จัดการประกวด
      • 5 ปี ที่ผ่านมา

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

      • 5 ปี ที่ผ่านมา
    2. nicola5
      ผู้จัดการประกวด
      • 5 ปี ที่ผ่านมา

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

      • 5 ปี ที่ผ่านมา

แสดงความคิดเห็นเพิ่มเติม

วิธีเริ่มต้นจัดการประกวด

  • ประกาศการประกวดของคุณ

    จัดการประกวดของคุณ รวดเร็วและง่ายดาย

  • รอรับผลงานจำนวนมหาศาล

    รอรับผลงานจำนวนมหาศาล จากทั่วโลก

  • มอบรางวัลให้แก่ผลงานที่ดีที่สุด

    มอบรางวัลให้แก่ผลงานที่ดีที่สุด ดาวน์โหลดไฟล์ - ง่ายดาย!

โพสต์การประกวดตอนนี้เลย หรือเข้าร่วมกับเราวันนี้!