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 年 之前

显示更多评论

如何以竞赛开始

  • 发布您的竞赛

    发起您的竞赛 快速简单

  • 获取众多参赛作品

    获取大量参赛作品 来自世界各地

  • 悬赏最佳参赛作品

    悬赏最佳参赛作品 下载文件-简单!

立即发布竞赛 或者立即加入我们!