Hello Friend i want to know how can i copy popup windows url using javascript
i need this llike
when i click on button popup window will open with short link url like goo.gl
i want to copy url under this short link please help me Thanks.
You can access the current URL within the window like
var url = window.location.href;
or the URL of a child window like
var newWindow = window.open('https://foo.bar');
var url = newWindow.location.href;
(although that’d be kind of redundant, obviously) ^^
But what do you mean with copy… to the clipboard?
I mean , I want this URL to foreword it to another page
You mean a redirect? You can change the window location the same way you can retrieve it, like
window.location.href = 'https://new.uri';
I have to admit though that I’m not really sure what you’re getting at… could you provide a specific scenario, or maybe some code you got so far?
(Also, with opening new windows and redirects I have the impression that you’re trying to do things which might better be achieved in a much less obtrusive way…) ^^
Agreed. Simply don’t use shortened URLs in your pop-up.
If your intent is to have the end result be the full URL I see no ethical reason why you shouldn’t initially use that instead of going through a short URL - redirect process.
Ahhh now I get it! :-D
Now what you might do instead (if you really must use those shortened URIs) is to define a server side rewrite in your .htaccess
file (or equivalent) – no browser surprises, just plain links.
Consider this: someone hovers that button, right clicks and copies or bookmarks the link. This simply won’t work if you’re performing client side redirects.
As @Mittineague said though, still better would be to provide the actual links. If those include unsightly longish query strings, you might consider using POST
requests instead – these are not bookmarkable either, but at least you can show a message that the link doesn’t work this way, like e.g.
PHP
if (!isset($_POST('my_query')) {
echo '<a href="foo.bar">Go home!</a>';
}
okay
this is the URL https://goo.gl/Ejifsu
when open this URL it will send an error page
this is a Nokia access token I want to copy this URL
I am not put full URL because its too long. This URL send me on Fb page after that it will generate access token.
when use this first time its aks for allow apps permission after that any time you open this link its direct send you to token page.
after copy this token I want to forword it to HTML form like hidden field = access token and form send to login.php
this is it.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.