The Location object is a built-in JavaScript object that provides information about the current URL of a web page. It contains various properties allowing you to access and modify different parts of a URL.
To access the Location object, you can use the window.location property. This returns the Location object for the current web page. This object contains many data, such as the URL, pathname, origin, host, search data, and more.
In this article, you have learned how to get the current URL of a web page using JavaScript's Location object. By understanding how to work with the Location object, you can build more dynamic and interactive web applications that provide a better user experience.
Thank you for reading, and I hope you have found this article informative and helpful. You can read this article on how to refresh a page with JavaScript for more information on working with URLs in JavaScript.
All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.
Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams. RE: Bookmarklet: adds top frame to current page (w/o reload) jpo245 (Programmer)(OP)26 Sep 05 19:39Hi dwarfthower, basically a bookmarklet is one of those little buttons right below your browser address bar.
Usually the bookmarklet just points to " ", if u click on it.
However, instead of " ", u can also put in javascript instead.
Sites like have their own JS bookmarklet that allows u just to click on it, and it will pop up an "Add link" page in a new window.
Could u advise on how i'd insert a div tag on top of the current page? Many thanks!!
RE: Bookmarklet: adds top frame to current page (w/o reload) dwarfthrower (Programmer)26 Sep 05 20:41OK... to add a bookmark to say... firefox, go to Bookmarks / manage bookmarks and create a new bookmark for your button bar.
Enter the following (Cut & paste) into the location:
CODEjavascript:void(newDiv=document.createElement("div"));void(newDiv.setAttribute("style","background-color:#ffeeee;"));void(newDiv.innerHTML="This is a new Div");if(document.body.firstChild != null)void(document.body.insertBefore(newDiv,document.body.firstChild));elsevoid(document.body.appendChild(newDiv));
and voila... a shiny new bookmark that adds a div tag to the top of whatever document you happen to be browsing at the time.
You'll need to do some fiddling with the code to get whatever code you actually wanted in the div tag. Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams. RE: Bookmarklet: adds top frame to current page (w/o reload) jpo245 (Programmer)(OP)26 Sep 05 23:07Hi dwarfthrower, THANKS ONE BILLION TIMES!!
Basically, i've been spending 4 days finding out how to load a top frame dynamically without reloading everything else...
I did come close to the "insert div method" but never really thought much of it...
Now i have an evenmore elegant solution!!
Thanks again, can't wait to try it out...
RE: Bookmarklet: adds top frame to current page (w/o reload) tsdragon (Programmer)27 Sep 05 09:11If you do a google search on the term bookmarklets you will find a bunch of links to pages containing all kinds of bookmarklets for all kinds of things.
The real challenge in writing bookmarklets is that it all has to be on a single line, and it can't be any longer than the maximum allowed size of a url in your browser. Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. RE: Bookmarklet: adds top frame to current page (w/o reload) kaht (Programmer)27 Sep 05 09:21adam has also graciously provided a few helpful bookmarklets in the faq section:
FAQ216-4345 -kaht
...looks like you don't have a job, so why don't you get out there and feed Tina.
RE: Bookmarklet: adds top frame to current page (w/o reload) kaht (Programmer)27 Sep 05 12:58hmm..... thanks for the star
but adam0101 really deserves one on my behalf, maybe he'll pop in so we can "hook him up"? -kaht
...looks like you don't have a job, so why don't you get out there and feed Tina.
RE: Bookmarklet: adds top frame to current page (w/o reload) tsdragon (Programmer)27 Sep 05 13:40Outstanding FAQ! If adam does pop in he definitely deserves a star!
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. RE: Bookmarklet: adds top frame to current page (w/o reload) jpo245 (Programmer)(OP)29 Sep 05 01:45Hey dwarfthrower, i've been trying to tweak the code to do something meaningful, and have a question...
I noticed that the below were used to "append" or "insert" the new html code:
document.body.firstChild,
document.body.insertBefore
document.body.appendChild(newDiv)
My question is am i able to insert ANY kind of html in?
For example, forms, style, AJAX even, and any access to cookies too?
I have overcome the problem of 500 chars max for IE browser bookmarks by bootstrapping a remote js file, so no problem with that.
The reason why i ask this is because i intend to insert a slide out "form" that the user can type some information in, and then submit it to my server. I also hope to be able to prompt him to login in if his cookie is not set. All this via the appended/inserted div tag at the top...
Possible u think?
RE: Bookmarklet: adds top frame to current page (w/o reload) tsdragon (Programmer)29 Sep 05 08:45>> am i able to insert ANY kind of html in?
As long as you insert the html into a place that it is allowed, you shouldn't have a problem.
>> I have overcome the problem of 500 chars max for IE browser bookmarks by bootstrapping a remote js file, so no problem with that.
Would you mind sharing how you did that? Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. RE: Bookmarklet: adds top frame to current page (w/o reload) jpo245 (Programmer)(OP)29 Sep 05 20:48Hi tsdragon:
javascript:s=document.body.appendChild(document.createElement('script'));s.id='fs';s.language='javascript';void(s.src=' '); RE: Bookmarklet: adds top frame to current page (w/o reload) tsdragon (Programmer)30 Sep 05 09:01Thanks for the useful tip! A star for you! I've been wondering about a good way to work around that character limit since I first discovered bookmarklets and found there WAS a limit. Never got the chance to try to figure out a way around it. Now I don't have to. Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. googletag.cmd.push(function() googletag.display('div-gpt-ad-1406030581151-2'); ); Red Flag This PostPlease let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.
CancelRed Flag SubmittedThank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.
The problem I have is that I want my menu to not only be responsive, but to highlight which page a person is currently on. The highlighting part has managed to elude me however and is what I need help with.
I'm having trouble finding a javascript that will allow a print button to print only the current page in LiveCycle Designer. The document that requires this is dynamic and the page number for any page can change at any time. Therefore, using a page number for first and last page will not work. Any ideas?
Alternatively, you can refresh a page using the history.go() method to load a specific page from the session history or to go backward or forward through the session history. This method takes in a single argument, delta, that indicates the position in history to move to, relative to the current page. A negative delta value moves backward in the session history, and a positive value moves forward. If you add no argument or set delta to 0, the history.go() method has the same effect as calling location.reload() and the current page will reload.
Make your javascript request to the url /products/product-search/ApplySearch - rather than rely on the default MVC routing of controller/Action which in this case would be ProductSearchPage/ApplySearch. Although both of these requests will be routed correctly, the currentPage object won't be bound as Episerver can't work out the context of the request, ie what content the request should be mapped to.
I wish I can click on a bookmarklet on the Bookmarks bar to display the Wayback Machine's search results for the current page. In other words, I wish there can be a bookmarklet that opens the following URL:
I'm currently working on a Google Chrome extension and I need to run a JavaScript in the context of the current page. The obvious choice for such a logic is the content script. However it is not so easy, because the content script has an access only to the DOM of the current page. It can't run global functions or use global objects.
I solved the problem by inserting a new script node in the current page. The new script tag contains my custom javascript which is run immediately. There is one problem with my solution - you can't get the result back to the extension. So, if you need to run something, but you don't care about the result feel free to use the following script in your content file
This script should be added inside your background script. There is similar method for inserting CSS - insertCSS. The bad news are that the js code send to executeScript can't access another js code available on your page. You have again access only to the DOM elements. Something like this will not work
ffe2fad269