This should be simple, I want to know how to open a new page in the same window using VBScript?
steps:
when open page go to database
retrieve the records you need
Build URL where you want user to be redirected
Using response.redirect send user to desired page. It will open page in the same window.
You also can use JavaScript set.location to same url with basically same effect.
Depends on how heavy data is and how well your data retrieval methods are it could be so fast that user nor even realizes that he was not on the same page, however if browser set to alert user on redirect that would be a different story.
If you are trying to redirect your page to a new page you should be able to use a redirect
really simple example vbscript:
Dim URL
URL = "mywebpage.com/newpage.asp"
Response.Redirect (URL)
this page has a few other examples:
http://msdn.microsoft.com/en-us/library/ms524309%28v=vs.90%29.aspx
Related
I am trying to make a navigation button that just sends me to the index page but shows a different text in the url.
so i found this line of code to help me do it.
window.history.pushState("index.php", "test", "Testie");
But the problem is when i run it in an onclick function it just takes the last value and puts it in the url bar.
That itself is not the problem its that i dont have a Testie.html/php file.
I want it to be send to index.php but make the appearance of Testie in the url.
How do i do it?
The purpose of history.pushState is to say:
Some other JavaScript has manipulated the page so what the user is seeing is the same as what they would see if they went to this URL.
It lets you get fast updates to the page and bookmarkable URLs with real content that is good for fast initial page loads and for search engines to index.
It doesn't send data to the server (you need to do that with other code).
It does mean that if the URL isn't actually handled by the server (as you say it is in your case) then the page will break if the user does bookmark the page (or refreshes it, or sends the link to someone, etc).
If you want to navigate to a URL with Testie in it, then the first thing to do is to make the server support it. Forget about JavaScript.
Hi there, as you can see on the image, in my webpage I have several pages that can redirect to the same page.
On the example, both pages:
example.com/content.html -> example.com/news.html
example.com/files/actual.html -> example.com/news.html
I want to enable a button on the page example.com/news.html which goes back to the full source refereer url
So for example, if user A got redirected to example.com/news.html through example.com/content.html his Go back button should point to the source URL -> example.com/content.html
I have tried the JS property
var referrer = document.referrer;
console.log(referrer);
But It only returns the domain name example.com and not the full URL example.com/content.html
Any thank is appreciated.
It depends on what you need. If you always have a redirection you can use :
window.history.go(-2);
Otherwise, you may have to manipulate the parameter using history informations.
Full documentation : https://developer.mozilla.org/en-US/docs/Web/API/History_API
What you are asking for is not possible. In modern browsers, a redirect does not replace the referrer, nor does the redirect appear in window.history. Using client side JavaScript, there is no way to tell that the user came through a redirect as opposed to clicking on a link that brought them to the page directly.
As a workaround you could change the redirect to add a parameter. example.com/content.html could redirect to example.com/news.html?from=content.html Then the JavaScript on news.html could look at the URL parameter to determine which page redirected.
Alternately, you could use server side solutions. Your server's access log would have a record of redirects. You could examine this log file to determine which page redirected.
I'm trying to create a link from a report I'm writing to a web page I've also written. The idea being that whoever is viewing the report can find the record they're interested in, then click on that entry and it will take them to the page relating to that record.
I've tried using
javascript:void(window.open('"+Fields!URL.Value.ToString()+"', '_blank'))
URL obviously being the datasource field that contains my URL. The link is clickable and does open a new tab and attempt to load a page. But the page has my report servers domain at the beginning of it (i.e. server/Reports/Pages/MyURL).
Obviously that page doesn't exist so the page doesn't (resource does not exist). Is there a way to stop window.open appending the report server to the beginning of MyURL, or is there another, better, method that I should be using instead?
Now i need to get source page url when i navigate any page under specific domain i tried this jquery code
$(document).ready(function() {
var referrer = document.referrer;
});
but i get the previous url page but i want to get the main link that open my domain for example i searched about my website from google then i open my website from google then i navigate any page under my domain ..... i want to get in any page that i come from google ..by the way my website is PHP.... can i make some thing like that ?!
On the server side, you can use $_SERVER['HTTP_REFERER'] to get the referrer.
Now when the user links (or submits) from one page to the next in your website, but you still want the website they originally came from instead of the page they just were on, you should remember the original referrer in some way, for instance by storing it in a session variable. Something like this:
$ref = $_SERVER['HTTP_REFERER']; // Get referrer
if (!$ref.strpos($_SERVER['HTTP_HOST'])) // It's not from the same domain?
$_SESSION['originalreferrer'] = $ref; // Nope, store in session
Then you will have $_SESSION['originalreferrer'] as the original referrer, as long as you include this code in each of your pages that may serve as a landing page from outside.
I need to do the following:
I have a textbox, which appears in every page of the site, that allows to subscribe to a newsletter. This I've done already and the user is redirected to previous view after subscription.
I'd like to add a javascript alert to the page the user is returned to, something like "Thanks for subscribing". How can this be done?
Thanks in advance.
EDIT: Propably it's not clear from the post tags. I'm using ASP.NET MVC 2 Preview 1
If you are doing a HTTP redirect, then the page you will render needs to be passed some information so that it knows to include the javascript to open the alert box (adding an optional element to the page might be a nicer way to do this).
That information needs to be stored either in a browser cookie, or in a session store (which is keyed from a browser cookie). You can remove this once you've rendered your message, so that it is only shown the first time you visit that page after the redirect.