How to change the omni-bars value without changing the website? Javascript - javascript

I just wanted to know is there any way to change the omni-bars value without redirecting to another page using javascript? Maybe something like omni.value = "changed.net"

window.history.pushState(null, null, "/google.com");
This will change the url without reloading the page. If you did that in the console now the url would change to http://stackoverflow.com/google.com. You can only change the url from the web root. So you can't make it look like a user is at google.com itself.

Related

How do I create a link without the URL being visible in Javascript?

As part of printing the console.log for a Javascript project, I need to print a URL without showing it to the user. It should work like this:
Click Here
Upon clicking the 'Click Here' text, I should be able to redirect the user to the given link, and the user should not get to see the link.
Request someone to help with this.
What do you think about this solution?
<a onClick="window.location.href='https://google.com';"/>
You will need a href attribute to your anchor tag. This href will be shown to the user in the bottom left. But you could do something like this:
Link
The javascript in the href will do literally nothing. And the javascript in the onclick function will redirect to the link.
Unfortunately the user sees something like this in the bottom left:
May be little indirect way like this.
Click Here
Its actually very simple.
Just using base64 encoded value twice (or some other encryption logic).
But note any client side code is never secure.
Example:
If you use encryption, there is no way you can call decryption without storing the key in client variable.

How to Replace the path name of URL using JavaScript/jQuery?

I am trying to replace the url and load the page.
Example:
URL: http://www.example.com/account/edit
I want to replace this as http://www.example.com/account/add. And load this page.
For that, I tried by using location.pathname.
location.pathname = "/account/add";
When using like above, the add page is displayed. But after that, URL http://www.example.com/account/add is loading. Then the add page is not displayed. I get that page is not found message.
The host name should vary based on running the project. So I want to resolve this without based on host name.
How can I achieve it?
If you want to retain the page in your session history (meaning you want to be able to use the back button to it) use the assign method. Otherwise, you replace.
Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.
http://mdn.beonex.com/en/DOM/window.location.html
window.location.href = "http://www.example.com/account/add";
OR
window.location.replace("http://www.example.com/account/add");
This will redirect to the new page.
Actually you can change your url some other ways like below:
window.location.assign("http://www.mozilla.org"); // or
window.location = "http://www.mozilla.org";

ASP.Net page: Chrome adds a #b to the URL?

when I open the URL
http://mycomputer/web/Page.aspx?OfflineMode=false&ID=2
Chrome will make it look like:
http://mycomputer/web/Page.aspx?OfflineMode=false&ID=2#b
The problem is that I do javascript reloads via the URL with changed parameters and this is disturbing the process.
Any ideas?
Without seeing the page online to troubleshoot it, I would say save the url as a string and then modify the string. Then trying reloading based on the new string.
Is it always just #b added? And do you have an inner page links?

How do I change content without changing pages (non-hashed URLs)?

I know how to change content of a page using AJAX and remote loading of content. However, take a look at UStream's new layout. Click on any video, and not only does the content change without changing the page itself... but the entire URL changes as well. How is this done?
I know how to do it using the hashtag in a URL, and using JavaScript to detect when the location's hash value has changed. For example, site.com/#!/profile to site.com/#!/settings. Any value after the #! part is loaded remotely.
But UStream doesn't use the hash symbol at all. How is this accomplished? What voodoo is at work here?
You're seeing the HTML5 History API.

Set value in textbox in external website when user clicks link on my website

I have my own website. There is a link on my website which redirect me to the externel website. I want to know how to set value in textbox in that externel website when user click link on my website
Have you tried to save opened window handler?
var openedWindow = window.open(....
Instead of using direct links.
Or maybe pass parameters through url?
you can add parameters on the URL.
just modify the link accordingly, and read the URL parameter on the other site.
(this assumes you don't care the possibility that someone fills the parameters with fake info)
Unless that site has implemented something to let you set that (e.g. if they populate the text field using data from the query string), you can't.
There is no standard mechanism for pre-populating forms via a link to the page containing the form.

Categories

Resources