Created
January 10, 2013 15:14
-
-
Save arantius/4502790 to your computer and use it in GitHub Desktop.
Test for Greasemonkey issue 1673
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
if ($_POST) { | |
// Save the POSTed name in a cookie. | |
setcookie('script_name', $_POST['script_name']); | |
// Redirect to the user script installation handler. | |
//xxx header("Location: {$_SERVER['REQUEST_URI']}?.user.js"); | |
?> | |
<meta http-equiv="refresh" content="0;<?=$_SERVER['REQUEST_URI']?>?.user.js"> | |
<? | |
} else if (false !== strpos($_SERVER['REQUEST_URI'], '.user.js')) { | |
header('Content-Type: text/javascript'); | |
?> | |
// ==UserScript== | |
// @name <?=$_COOKIE['script_name']?> | |
// ==/UserScript== | |
console.log('test script dynamically generated from POSTed data'); | |
<? | |
} else { | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Greasemonkey POST + install test</title> | |
<body> | |
<form method='post'> | |
Script name: <input type='text' name='script_name'> | |
<input type='submit'> | |
<? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment