Website open in single window - javascript

Is it possible to make my website url always open in single window where if user even try to run url in tab then my website automatically redirect and open in single popup wimdow.?
Please share your idea and help how I do this if it is possible thank u all.

Simple answer is no.
It's not logical or reasonable.
You can't control browser but you can control another page in your website to have fixed height and width in a new pop up browser control.
onClick="window.open('yourpage.htm',' pagename','resizable,height=260,width=370'); return false;"

Related

How can I remove the moz-extension:// in the popup window Firefox extension created?

Currently, I'm developing an Firefox extension app. It will open a html file in a new popup window. When the poup window opened, it shows the title as format: "moz-extensions://", does anyone know how can I remove the prefix, the "moz-extension://"?
Thank you very much!
Answer
According to this bug report you can't currently do anything about it. It is present to prevent spoofing/phishing attacks against the user (acting like the popup is part of a UI).
Statement (Quote):
We've been trying to make it clear that when something happens, the
reason for it is clear to the end user. The ability to create a popup
with no URL bar means that there could be absolutely no info to the
user.
Custom Solution
If you want to have a popup with a custom title you would be better off creating your own HTML/CSS solution!

Navigate on another website using Javascript (Fill out a searchField and click search)

It is just that, I have a button that opens the website, but I can't figure out how to fill that field on that website and search for the String that I'm providing.
I really don't know where to look for this.
Right now, I open the website with :window.open(url); but that's it.
Using console, I can fill the txtInput using this $('#txtBuscar').val('geo');
Then click the button with this: $('#btnBuscar').click();
But I don't know how to do this from my function...
Any ideas on what to use?
Website is https://www.mercadopublico.cl/Home
You cannot do this without getting a Cross-Origin Resource Sharing (CORS) error.
Unless the site you are accessing allows it, you cannot access the code.
See How does Access-Control-Allow-Origin header work? for a full explanation.
I think you can't do that. Because when you use window.open(url); the browser opens a new window with url, but you script will be running in the previous window.
You could have the new site open up in an iframe on your page and then navigate the dom with your pages javaScript.

Force iframe (on different domain) links to open in a new window

Contained within my web page is an iframe that's src is set to load a page from another domain.
This domain has links with target="_top".
What I'm trying to achieve is, when someone clicks one of these links, I'd like it to open in a new window rather than load in the current window.
Is there any way to "catch" this and do what I require?
Thanks!
The domain has probably very good reasons to put target="_top" in their links. They don't want to be ran inside a(n) (i)frame. The correct answer to this is "No, this can't be done." Obvious security reasons prohibit us to do this.
You don't want somebody messing with your page by running it in an iframe. Phising and password retrieval becomes kind of easy when this is allowed. Browsers will not allow this these days.

Auto-loading page on start up into pop-up window when pop-up window is active

Hard to come up with a title, my apologizes.
Problem is this: Since modern web-browsers disable pop-up windows I am in need of a work-around.
When a visitor comes to the website they are prompt to press a button. Once the button is pressed a pop-up window is launched with the following code:
w = window.open('/audio/audioplayer.php?id='+audioId, 'audioplayer', params);
Now that the pop-up is open I would like when the visitor views other pages the pop-up is loaded with specific information based on whatever page they are on.
I am not sure if this is possible or how I can do this (check if the pop-up window is open, and if it is load the information, and if its not re-display the button)
I don't think it is possible to detect where the popup is open of not.
Have you thought about using a dialog? Rather than a popup?
window.open returns a windowObjectReference - this is the only way you can talk to the popup window. In particular, you can tell if that window is closed with the windowObjectReference.closed attribute. And the popup window has a window.opener attribute that references the parent window back. You can use both to communicate.
However, it seems you want to keep this communication between page loads. You have a few options:
Try to keep the link between windows as long as possible. The problem is that when the parent window reloads, all the javascript variables reset and there's no way to recover the reference to the popup - unless the popup sets it using window.opener. This link shows this approach and also another one with frames.You could consider it either ugly or clever. But it's not perfect. (You can't do anything if the user opens a page in a new link)
Communicate with the server using ajax from both main pages and the popup page. When a top level page wants to send a message to the popup, they start an XMLHttpRequest to your server which notifies a script which leaves a message in a "queue". The popup page regularly polls/long-polls the server with XHR too (or server sent events, my personal favorite) and updates its own contents accordingly.This might be a bit more complex/expensive than you'd like but it's also the safest solution.
Don't use popups, like the other answer suggested. A div with position: fixed could get you a similar result, and might save you from that method of communication between windows, however it also leads to having one dialog per page, so you need to ask the server if another instance of the dialog is running. Not quite sure if other methods of sync are viable for this (localstorage?)

Javascript for removing menu and scroll bars

I have this script on my html page:
<script language='javascript'>parent.resizeTo(550,510);</script>
I'd like to add to it so it positions the window in the middle of the screen. Also, I want to remove the address and tool bars (I've managed to hide the scrollbars by using body{overflow:hidden;}).
I know how to do this using JS upon opening a new window from the browser but this needs to work from clicking a link on a PDF.
Does anyone have any suggestions? Thank you!
You can't remove address bars, etc. from the user's browser window (even if the user is only you) unless you create a new window object. And the trend is toward removing more and more of your ability to "customize" such popup windows, for security reasons.
This is actually a feature, not a bug. Think about it.
If you're opening a browser window from a separate application, the page starts off its life with a completely-decorated browser window. There's no way to make those decorations go away after the page is loaded.
While I seriously doubt the justification of your desires the way to do it is to somehow open a window. That means that your pdf links to a page that as its action will open a window with an url that has the actual content. The pdf links to a page that is basically a redirector. You give the final URL as a parameter and launch it. Of course you need to disable the popup blocker for this to work, but you should not even consider doing this on a public (no browser control) website anyway. You also might want to add to the redirector page a button that the user can click to open the page if it was blocked by the popup blocker.

Categories