如何通过单击PHP或JavaScript中的后退按钮将用户重定向到上次访问的页面

时间:2018-05-09 09:22:50

标签: javascript php jquery

如何在PHP和&amp ;;中跟踪用户访问过的页面? JavaScript的。我正在使用 public static String testUploadService(String httpURL, File filePath,String User,String Pass,Processing processing) throws Exception { // Thread.sleep(500); // local variables ClientConfig clientConfig = null; Client client = null; WebTarget webTarget = null; Invocation.Builder invocationBuilder = null; Response response = null; FileDataBodyPart fileDataBodyPart = null; FormDataMultiPart formDataMultiPart = null; int responseCode; String responseMessageFromServer = null; String responseString = null; String name = User; String password = Pass; String authString = name + ":" + password; String sdc="sdc"; byte[] encoding = Base64.getEncoder().encode(authString.getBytes()); byte[] encoding2 = Base64.getEncoder().encode(sdc.getBytes()); String USER_PASS = new String(encoding); String auth2=new String(encoding2); String boundary = "=-=" + System.currentTimeMillis() + "=-="; // Thread.sleep(500); try{ // invoke service after setting necessary parameters ClientConfig cc = new ClientConfig(); cc.register(MultiPartFeature.class); try { client = new JerseywithSSL().initClient(cc); } catch (KeyManagementException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } webTarget = client.target(httpURL); // set file upload values fileDataBodyPart = new FileDataBodyPart("file", filePath, MediaType.APPLICATION_OCTET_STREAM_TYPE); formDataMultiPart = new FormDataMultiPart(); formDataMultiPart.bodyPart(fileDataBodyPart); invocationBuilder = webTarget.request();//.header("Authorization", "Basic " + authString); invocationBuilder.header("Authorization", "Basic " + USER_PASS); invocationBuilder.header("X-Requested-By","SDC"); invocationBuilder.header("Content-type", "multipart/form-data; boundary=" + boundary); try{response = invocationBuilder.post(Entity.entity(formDataMultiPart, MediaType.MULTIPART_FORM_DATA));} catch(Exception ex){ ex.printStackTrace(); } responseCode = response.getStatus(); System.out.println("Response code: " + responseCode); if (response.getStatus() != 200) { // throw new RuntimeException("Failed with HTTP error code : " + responseCode); } System.out.println("Check 6"); // get response message responseMessageFromServer = response.getStatusInfo().getReasonPhrase(); System.out.println("ResponseMessageFromServer: " + responseMessageFromServer); System.out.println("Check 7"); processing.setlabel("Finished"); processing.setprogress(100); // get response string responseString = response.readEntity(String.class); processing.finished("Server Response Code - "+responseCode + "\n ResponseMessageFromServer: "+ responseString); } catch(Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, "Error!! \n Make sure you are connected to Dell Internal Network"); processing.dispose(); } finally{ // release resources, if any fileDataBodyPart.cleanup(); formDataMultiPart.cleanup(); formDataMultiPart.close(); response.close(); client.close(); } return responseString; } 功能,这只给我上次访问过的网址。

例如 -

我有三页 A,B& ç即可。

如果我从 A 转到 B B 转到 C 页面。如果我点击后退按钮,则从 C 页面返回 B ,这是正确的。但是如果点击 B 页面, B ,它会再次转到 C ,但我想返回页面 A

如何跟踪我的页面访问历史记录?

0 个答案:

没有答案