I'm quiet new to JavaScript and need your help concerning the following problem:
I've written a JavaScript to subscribe automatically to a gym class every monday at 7 a.m..
I have to click a button that's opening a new tab where I have to fill my personal data. The URL of the new tab is variable so I cant do it via
window.open(URL,"_self")
Is there a way to continue the script in the new tab or open the website in the same tab?
Thanks!
Because of the objections mentioned, that doesn't sound feasible to me - at least in this form. If you want to run a script on the external website, then simply use a browser solution such as:
Tampermonkey (https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en)
Greasemonkey (https://addons.mozilla.org/de/firefox/addon/greasemonkey/)
There you can install your script and have it automatically fill out your registration.
If you want to automate this completely without doing anything on your part, then you will not be able to avoid an (external server-side) solution such as a NodeJS application with puppeteer (https://github.com/puppeteer/puppeteer) running every X days.
Related
I'm looking for a way to recreate the functionality of a refreshing page extension on a browser (e.g. Auto refresh plus in Chrome) by using javascript. The problem is that I have no ideia how to achieve that.
I must find a way to refresh the page every second or so, click on a link that appears on the page from time to time, add a sound effect for when it appears and send an e-mail notification every time it appears.
I'm trying to use a simple javascript snippet to run in the console in order to refresh the page:
win1 = window.open("https://www.myUrl.com/");
timer1 = setInterval(function(){win1.location.href="https://www.myUrl.com/"}, 1500);
However, this implies running code from tab A on tab B which I found very challenging.
The code can't run on tab A alone because at the time it refreshes the page, it gets erased from the console.
I know it would have been so much easier to use an extension, but the platform I work for does not allowed any extensions.
I have basic HTML and javascript knowledge, but I find this would be a good project to learn more.
Also, if the solution involves other languages, I just need a direction to know where to look for and start this project.
This question already has answers here:
Open a URL in a new tab (and not a new window)
(33 answers)
Closed 4 years ago.
I create event registration websites in a system called Cvent. It is a system specifically designed to allow non-coders to create a registration website where attendees/invitees can come and register, for example, for a convention, or a meeting, or an incentive trip. Cvent also allows advanced coding in order to customize the event site. I code advanced sites.There are times that I am unable to access some coding because it was created within Cvent - think of it is a widget. In a nutshell, I have some links to other reference sites that was coded by Cvent and it did not include target="_blank" within the hyperlink. Is there any script that I can add to a page that will force any existing hyperlink to open in a new tab? Maybe a couple screenshots will help explain my situation....
I am entering in the name and the url to be linked to the name, which Cvent codes for me in the background...
On the front end of the site, it looks like this
screenshot of the front end of this link
When an attendee/invitee clicks on that link, it opens up in this same tab. I need it to open in a new tab. Is there any type of script that will force all hyperlinks to open in a new tab?
I do now how to code javascript so I have not tried anything. I've searched but not really finding anything that helps. It's a pretty specific problem because of the restrictions I'm coding under.
If you are using then put target='_blank'
Or for javascript use window.open()
Hope it will help you,
Thanks.
When a user clicks on a hyperlink I would like to launch a JavaScript function and also launch a page in a new window. My preference if possible is to use HTML for the new page in case the person lacks JavaScript as fallback.
The following code launches page but not JavaScript.
click
Can someone recommend correct way to so this. Thx
I'm using a bookmarklet that lets me share the current URL on Google Plus.
Here's the JavaScript:
javascript:(function(){var w=480;var h=380;var x=Number((window.screen.width-w)/2);
var y=Number((window.screen.height-h)/2);
window.open('https://plusone.google.com/_/+1/confirm?hl=en&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'','width='+w+',height='+h+',left='+x+',top='+y+',scrollbars=no');})();
Is there a way to detect the "Sharing Successful" event and call a window.close()? And where do I call it in this JS? Even a pointer in this direction will be appreciated.
Is there a way to detect the "Sharing Successful" event and call a window.close()?
No you can't.
Browser security prevents you from using Javascript on one page to interact with another page on a different domain. This is why I can't put up a website that opens your bank's website in an iframe and then controls it.
The Javascript in a bookmarklet is considered to be part of the page that is open when you execute it. So the code becomes part of the page you are adding to Google Plus, and it can not interact with the page from Google because it is on a different domain; and vice versa. The code can open the window, but that is all.
To do what you want would require creating an add-on, extension, or user script.
I'm trying to fill out two textfields and press a button programmatically that is opened in a webview in my webos app. Is there any possibility to do that? The website has to be openend in a webview because it refreshes every 30 seconds. (I wan't to log me in automatically to our university's homepage.)
I doubt you will be able to script the contents of the WebView directly (too many potential security issues at stake).
However, you might be able to simulate a Javascript bookmarklet by loading the page and then using the WebView's openURL method to run a bookmarklet that fills out the fields and submits the form (so something like myWebView.mojo.openURL('javascript:DO_STUFF_HERE') might work). I have never had a need to test this sort of thing, but that's the only way I can think of that you'd be able to execute Javascript within a WebView.
Good luck!