Modify top frame with javascript, crossdomain? - javascript

i would like to have a frame on a page with a script that shows a modal in the parent-frame.
the problem is that the pages is on 2 different domains, and it seems that the browsers does not allow this when doing this crossdomain.
Is there any way to go around this so it works?
And which browsers would this work on?

Here are a couple of possible solutions:
http://www.cakemail.com/blog/the-iframe-cross-domain-policy-problem/

I came across the same problem, and I'm pretty sure that it is not possible since they're from different domains, for « security reasons ».
Also, some browsers (like Google Chrome) don't do simple modals (you can click behind the modal without a problem) using the showModalDialog method.
We don't really know your situation so I can't think of a workaround.
I wish you the best of luck!

Related

Why is the javascript psuedo-protocol not working?

So, I'm trying to run on random websites, to play with the javascript psuedo-protocol.
javascript:alert("testtesttest");
And it never works. I've tried 6 websites, and I have no clue what I'm doing wrong. I've tried googling with little success. I'm using the latest version of firefox, and I have javascript enabled.
Firefox disabled it for security reasons, because people were pasting things they were told to in the address bar.
but it still works, if you trigger it from your javascript code.
And in chrome code, I found many cases, a window is initialized with this kind of protocol.
For example if you visit http://www.w3schools.com/jsref/met_win_settimeout.asp
There will be some inside windows to be opened with
javascript:"<html><body%20style='background:transparent'></body></html>"
then later on, the location.href changed to
http://www.w3schools.com/jsref/met_win_settimeout.asp
Any one knows why this kind of change happens, and why it is allowed?
Does it suggest for layer window, the location of the window can be changed to the main page?

opt in for window.resizeTo?

I'm building an in-browser application for my company's internal use. It would be helpful if my users could quickly switch between 6 different browser dimensions. I've tried using window.resizeTo, but it seems most modern browsers are disabling any sort of coded resizing. Safari seems to be my only exception for Mac users, but I'm concerned that they too will follow suit with Chrome and FF.
Is anybody aware of any work-arounds or user opt-ins? I've found a Chrome extension that can get the job done, but ideally there wouldn't have to be any sort of configuration or 3rd party extensions as some of my users have very strict permissions on their machines.
No, that's not possible. Otherwise all kind of ads would ask the user to allow them to resize themselves in the hope some people allow it (and thus most likely allow it for the whole adserver used by tons of websites).
You could wrap your application's content in a <div> with overflow: scroll, and resize that actual div. If your application's styles do not allow that, you can wrap it in an <iframe> with the viewport size you want to enforce.

Loading javascript in an iFrame on different subdomains

I have a javascript function that loads CKEditor in one of my iFrames. Problem is that my iFrame is located on a different subdomain. I fixed this by using document.domain, however my CKeditor only loads sometimes. Does anyone know how to solve this?
I've not tested it myself, but give this a try : iframe-xdr

How do I change the browser width/height in jQuery?

Can't figure this out for the life of me. Google is no help either. I'm sure its super easy.
It's not that easy. For one thing, this is generally something you should not do. Firefox for example has an option to disable Javascript from resizing the browser. It's considered anything from a security risk to just a plain annoyanace.
Resizing the browser puts you in the same bucket as poker and "She's waiting for you!" sites. Just don't do it.
If you need a window of a specific size, open one of that size with the options to window.open().
Having read all that if you still must do it, use window.resizeTo().

Set default home page in JavaScript

How do I create a link to set the user's home page to my URL?
As some people have already answered, it used to be possible in internet explorer (prior to IE 7 I believe, could be wrong though) using something similar to
document.setHomePage('www.example.com');
I don't think any browser supports it anymore though. However, I would definitely try to convince you to do otherwise. Most people won't like having their settings automatically changed, even if it's triggered by a mouse click or other action. It's also quite likely that overzealous 'protection' programs will jump all over it and stamp it as a malicious attack.
As far as I know it's just possible in Internet Explorer
Make my Page your
<a href="javascript:history.go(0)" onClick="this.style.behavior='url(#default#homepage)';
this.setHomePage('http://www.test.de');">Startpage</a>.
I assume you mean put a link in your page to make it the browser homepage? In IE you can do something like:
this.setHomePage('http://www.mysite.com');
I don't think that works in Firefox though.

Categories