Jump to content

[SOLVED] addres questionmark (?)


qbox

Recommended Posts

A javascript file can't directly use that variable like PHP can. In this case, they are doing one of two things.

 

1) The .js file is actually a server side script. This means that even though it's a .js file, they have configured their webserver to treat the file as a server side script (like PHP). Their server side script can then read that GET variable, and return a javascript file.

 

2) Less likely, the javascript is parsing that value from the HTML in the page. After the page loads, you can grab the SCRIPT elements with document.getElementByTagName('SCRIPT'), search for the one you want, then parse the value off the src attribute

yes...easiest way to do this, it just make a PHP script and use the header() function

[code=script.php?ident=9iUiaa]<?php
  //It is good to send the content type, but i don't think it's needed
  header('Content-type: text/javascript');
  print "alert('ident is set to: {$_GET['ident']}');";
?>

 

and it put it on a page:

<html>
  <head>
    <script type="text/javascript" src="script.php?ident=9iUiaa"></script>
  </head>
  <body>
  ...
  </body>
</html>

 

...the file doesn't have to be a .js file. but, once you get the above working, you can use Apache's mod_rewrite to 'mask' it as a .js file

 

[/code]

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.