Message from JavaScript discussions
October 2018
— Now it's correct
Hi guys! I would like to create a script in js that should work like this (in html file)
<script>
window.location.href="www.google.com";
//Then, after the page is fully loaded, it writes something in the search bar
<\script>
But it won't work, because if the url changes, the script will stop.
How can I solve it?
(A workaround is using a Chrome extension that executes specific scripts in specific urls, but I would like to not use any extension)
— Set location after page has loaded instead?
—
const url =
'https://www.google.com/';
document
.addEventListener('load', () =>
location.href =
url + '?query=hello');
— Yeah, I know I could achieve it using query (?hello), but I would like to know if i can do that where querying is not possible.
In general, how can make JavaScript(s) automatically execute(s) in specific url(s)?
For example, I can do that using an extension such as Requestly, but I would like to not use any extension
— Wat
— Impossible
— Would be a massive security hole
— I guess I have to use a server sided language, such as python or php right?
— I've re-pinned it just in case
— Holy shit
— That is a ton more than just 10% or whatever the percentage was predicted to be