Close Window opened manually in script - javascript

I am trying to close the current tab when the user clicks on the 'CloseWindow' Button. Whatever I try
VM303:1 Scripts may close only the windows that were opened by them.
statement is displayed. I tried all the workarounds using self, window.opener.close() etc.
Has anyone done and it's working please share and help. I am using React framework. I am trying this in a jsx file.

Related

How to make window.open() pop up a sticky popup?

I am creating a program where i use popup with the help of javascript window.open(). It is working fine but i want to make it sticky popup. Here i try make you understand what i'm looking for. For ex. I have page called add_data.php in this page i have button called upload picture when i click upload picture button a popup appears where pircture can b uploaded. But i dont want to user allow to do anything on other tabs until upload picture tab is completed or closed. In other words i want to stick the picture upload popup.
There is no way to make a new browser window modal.
People doing this sort of thing generally use DOM manipulation to display new UI elements on top of the current page (which block accesses to the rest of the page using overlays and methods to disable access with the tab key etc).
There are lots of JavaScript libraries / UI frameworks that provide a modal.

Is it possible to inject a chrome extension popup into current webpage without using react?

I'm currently working on chrome extension and I'm dealing with a content injection problem.
In my extension when user clicks the button inside the popup, he has possibility to choose DIV from the webpage he's currently on and then he can return back to popup to choose options for that chosen DIV.
The problem is that I can't force the popup to be open when user clicks outside it (actually I can with open popup console, but it's not a solution here) and the popup.html is reloading every time extension is shown to user.
So I came up with an idea that I can inject a popup into an iframe in the webpage to have control over it's behaviour but I found similar solutions only connected with chrome extensions based on react. Is it possible without any framework?
Any help would be greatly appreciated.

How to found which script is run when i click anywhere in website?

Actually, I am working on a WordPress website and I use a theme for it. The problem is that daily I open first time my website and click anywhere in the body it open google ads in new browser window like facebook, jabong and all. So how to remove that. And also after every cleaning browser cookies and history process same issue, I get. Please let me know how to fix it and how to determine what function run when I click?
Thanks in Advance.

how to open web application in a browser without navigation buttons

I have a web application, and I want to disable the Back button.
I read and found that I can open the browser without the navigation controls with the function window.open(...).
This is the code:
window.open (mywebappURL,"mywindow","status=1,toolbar=0");
I tried to put it in my Main.Master page, but I get an infinite loop and the new window is opened as a popup window of my application.
Does anyone knows where should I put this code to get my web application opened in a browser without navigation buttons?
Thanks,
Inbal.
try this on the link's onclick() event
function openPopup(){
var pathname = (window.location.pathname);
window.open(pathname+'somePopup.html','','width=800,height=450,resizable=yes,dependent,screenx=80,screeny=80,left=80,top=20,scrollbars=no');
return false;
}
and in the html
click me
To answer your question directly, make sure the window you're opening is a different URL than the window that's initially visited. So your visitor might arrive at www.example.com/index.html which then opens www.example.com/popup.html
If you open index.html again, the new copy will immediately open a popup, which will immediately open a popup, and there's your infinite loop.
However, as several people have commented already, this is generally discouraged. Among other disadvantages to this approach, popup blockers will likely interpret this as trying to launch a popup advertisement, forcing your visitors to recognize what's happened and change their settings.

how to open a facebook login page in a iframe insted of popup

I am using facebook login button in website. when i clicked on that it opens a popup. insted of popup i want to open that in a iframe. is there any way to do that using javascript.
plz help me.
thanks in advance.
Show some of your code. Is the code that opens the popup yours or included from some other site? If it's not your own code and it uses window.open, there's nothing much you can do.
If it's your code, use something like this onClick: document.getElementByID('iFrameID').src=url;
Keep in mind that if the facebook-login (which will be an external page) expects to be running in a popup window could execute window.close to return to your page, which may cause problems if you're using an iFrame.

Categories

Resources