Results 1 to 3 of 3

Thread: Getting website elements with javascript.

  1. #1
    Join Date
    Jun 2013

    Thumbs up Getting website elements with javascript.

    Hi there , this is my first post and i'm looking forward for someone to help me ..

    (description of my problem) I have a website that will serve as a search engine .
    My website will use other websites to serve as search engines . I created an hidden <iframe> to load those websites .

    I want to make it that when an user inputs text in the search box , the JavaScript takes the input and replaces the <iframe> id with the text .

    eg: the user will input "game" in my website ... so the url for the iframe will be : example.com/search/game/0/8 ..... [/search/name/0/8 needs to stay like it is .. only the name changes

    So now the <iframe> loads example.com/search/game/0/8 hidden so the user wont view the whole search results .... How can i use javascript to only get some information from this results webpage ?

    i've have 2 js ready but they have some minor problems because the user needs to input for eg : http://www.example.com/search/name/0/8 and not input only "name"

    <iframe id="iframeId" src="http://www.thepiratebay.se/search/" class="rte-zone" width="0" height="0" >
    <script type="text/javascript">
    var iframeDoc;
    if (window.frames && window.frames.iframeId &&
    (iframeDoc = window.frames.iframeId.document)) {
    var iframeBody = iframeDoc.body;
    var ifromContent = iframeBody.innerHTML;
    <script type="text/javascript">
    function getContentFromIframe(iFrameName) {
    var myIFrame = document.getElementById(iFrameName);
    var content = myIFrame.contentWindow.document.body.innerHTML;
    var status = content.getElementById('AREA:222_4');

    PLEASE I know that only one user can't reply with a help in all this , but if you know even a small thing please reply with that small tip .

    Thanks in advance.

  2. #2
    Join Date
    Oct 2010
    Versailles, France
    Search about "Same Origin" security policy or read this page at first

  3. #3
    Join Date
    Jun 2013
    I dont think that'll be a problem cuz from the iframe i tested and i can access the site .. i just need this little modification

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center