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

Link to comment
Share on other sites

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]

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.