www.webdeveloper.com
Results 1 to 6 of 6

Thread: Can external javascript process my URLs?

Hybrid View

  1. #1
    Join Date
    May 2011
    Posts
    3

    Can external javascript process my URLs?

    I have a 900+ row MySQL database, comprising 15 categories of site_name and URL details, dynamically accessed using a series of selects. These pages retrieved by these URLs are copied into the main contents frame of my home page. I am receiving a healthy number of hits each day but am unable to determine which links are most/least popular.
    I have hit the problem of storing the contents of parent.contents.location.href for further use I would like to either write them to a text file or directly back into MySQL for analysis purposes.

    The select code follows:
    (The $a is passed into the function as the value of site_code, which is not retrieved)

    $result_recordset=$db->Execute("select distinct site_name,site_link
    from site_list
    where site_code='$a'
    and site_name is not null
    and active = 'Y'
    order by site_name");
    ?>
    <FORM action="get">
    <select onChange="parent.contents.location.href=options[selectedIndex].value;">
    <?php
    while(!$result_recordset->EOF)
    {
    echo("<option value ='".$result_recordset->fields['site_link']."'> ".$result_recordset->fields['site_name']);
    $result_recordset->MoveNext();
    }
    unset($result);
    echo("</select>");
    $result.close;

    Is there any realistic chance of being able to pass the URL to an external javascript or php file for processing and preservation or am I flogging a dead horse and should consider a total rethink? I have no access to ASP or VB so am confined to PHP/Javascript/MySQL (not really a limitation!)
    The use of a separate SUBMIT button to perform a GET or POST would not suit the architecture as it now exists.

    Thanks for any help you guys can offer.

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    You could set the onChange to go to an HTML or PHP page with the site URL as a parameter, do whatever javascript or PHP you want with it, then redirect to the site.

  3. #3
    Join Date
    May 2011
    Posts
    3
    I didn't know whether an 'intermediate page' would do the trick. I guess you mean to use it as a 'black box' and 'dump' the data there en-route to the 'proper page' that would possibly solve things. Thanks for that! I'll give it a whirl.

  4. #4
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    Well... I don't know about 'black box'; but 'dumping' the data sounds about right.

    The important thing is that everything except going to the site URL will be behind the scenes; and unless there is a TON of data, or a lousy internet connection, or something bottlenecking the data, it should process invisibly to the user - from their point of view, it just goes to that site, nothing more.

  5. #5
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    use anchors instead of onclicks so you can use the ping attrib.

    or, simply add google analytics to each page review the nice colorful graphs of visitor stats google provides for free.

  6. #6
    Join Date
    May 2011
    Posts
    3
    Hi
    Thanks for the suggestions guys. Sorry about the late reply. I think my ISP has an issue with superglobals like $_GET, having upgraded to PHP5, so I'm trying to either get them turned back on or I'll have to have a workaround.
    I'll keep you posted on the eventual solution but I'm looking at getting the data passed to a javascript function using "this" and then calling the external php page from there having assigned parent.location.href to Result and passing

    location.href="page2.php?Result=" + Result;

    to the external php.

    This is new territory for me....trying to 'marry' client-side and server-side seems like a minefield!

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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



Recent Articles