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 χρόνια

Προβολή περισσότερων σχολίων

Πώς να ξεκινήσετε με τους διαγωνισμούς

  • Δημοσιεύστε τον διαγωνισμό σας

    Αναρτήστε τον διαγωνισμό σας Γρήγορα και εύκολα

  • Λάβε ένα σωρό συμμετοχές

    Λάβετε Πολλές Συμμετοχές Από όλο τον κόσμο

  • Βραβεύστε την καλύτερη καταχώρηση

    Βραβεύστε την καλύτερη καταχώρηση Κατεβάστε τα αρχεία - Εύκολα!

Αναρτήστε ένα Διαγωνισμό Τώρα ή Ελάτε Μαζί Μας Σήμερα!