Remove iframe when src matches pattern

S

Sudrien

I'm trying to make a bookmarklet/favlet thing that saves my bookmarks
remotely.

How it is supposed to work:

1. user clicks link on their toolbar.
2. javascript from my site loads, creating a lightbox-like prompt for
URL and title.
3. User hit form button to submit.
4. Ligthbox gives confimation message, then dissapears a few seconds
later


Part 4 is the problem. The confirmation comes up, but I keep on
recieving security errors (in firefox) from my remote script when I
try and see if the submission was a success.

the remote script is somthing like this:


=====

var body = document.getElementsByTagName('body')[0];

iframeDiv = document.createElement('div');
iframeDiv.style.position = "absolute";
iframeDiv.style.top = "0";
iframeDiv.style.left = "0";
iframeDiv.style.width = "100%";
iframeDiv.style.height = "100%";
iframeDiv.style.background = "#000";
iframeDiv.style.MozOpacity= "0.6";

iframe = document.createElement('iframe');
iframe.style.position = "absolute";
iframe.style.top = "50%";
iframe.style.left = "50%";
iframe.style.width = "300px";
iframe.style.height = "150px";
iframe.style.background = "#fff";
iframe.style.margin = "-75px 0 0 -150px";
iframe.style.MozOpacity= "1.0";



iframe.id = 'makeMarkIframe';
iframe.name = 'makeMarkIframe';
iframe.src = 'http://thirdleft.org/submit.php?url=' +
encodeURIComponent(document.URL) + '&title=' +
encodeURIComponent(document.title);
/*iframe.onload = function() { console.log(frames['makeMarkIframe']);}
*/

iframeDiv.appendChild(iframe);
body.appendChild(iframeDiv);

=====

iframe.onload triggers correctly - whenever the iframe loads a page -
but there doesn't seem to be anything I can test on the submissions
success without security issues (url parameters of the iframe are what
I've been trying for).

I already tried XMLHTTPRequest - the warnings just come faster there.

Ideas?

-Sud.
 
D

David Mark

I'm trying to make a bookmarklet/favlet thing that saves my bookmarks
remotely.

How it is supposed to work:

1. user clicks link on their toolbar.
2. javascript from my site loads, creating a lightbox-like prompt for
URL and title.
3. User hit form button to submit.
4. Ligthbox gives confimation message, then dissapears a few seconds
later

Part 4 is the problem. The confirmation comes up, but I keep on
recieving security errors (in firefox) from my remote script when I
try and see if the submission was a success.

the remote script is somthing like this:

=====

var body = document.getElementsByTagName('body')[0];

iframeDiv = document.createElement('div');
iframeDiv.style.position = "absolute";
iframeDiv.style.top = "0";
iframeDiv.style.left = "0";
iframeDiv.style.width = "100%";
iframeDiv.style.height = "100%";
iframeDiv.style.background = "#000";
iframeDiv.style.MozOpacity= "0.6";

iframe = document.createElement('iframe');
iframe.style.position = "absolute";
iframe.style.top = "50%";
iframe.style.left = "50%";
iframe.style.width = "300px";
iframe.style.height = "150px";
iframe.style.background = "#fff";
iframe.style.margin = "-75px 0 0 -150px";
iframe.style.MozOpacity= "1.0";

iframe.id = 'makeMarkIframe';
iframe.name = 'makeMarkIframe';
iframe.src = 'http://thirdleft.org/submit.php?url='+
encodeURIComponent(document.URL) + '&title=' +
encodeURIComponent(document.title);
/*iframe.onload = function() { console.log(frames['makeMarkIframe']);}
*/

iframeDiv.appendChild(iframe);
body.appendChild(iframeDiv);

=====

iframe.onload triggers correctly - whenever the iframe loads a page -
but there doesn't seem to be anything I can test on the submissions
success without security issues (url parameters of the iframe are what
I've been trying for).

Unless the containing page is in the same domain, you can't get them.
Couldn't you just display a message in the IFrame concerning the
success of the submission? As for closing the box, you need to append
a link or button to do that when you create the IFrame.

Alternatively, you could get rid of the IFrame and use AJAX. It
sounds like you tried something of the sort, but was an IFrame still
involved?
 
S

Sudrien

I'm trying to make a bookmarklet/favlet thing that saves my bookmarks
remotely.
How it is supposed to work:
1. user clicks link on their toolbar.
2. javascript from my site loads, creating a lightbox-like prompt for
URL and title.
3. User hit form button to submit.
4. Ligthbox gives confimation message, then dissapears a few seconds
later
Part 4 is the problem. The confirmation comes up, but I keep on
recieving security errors (in firefox) from my remote script when I
try and see if the submission was a success.
the remote script is somthing like this:

var body = document.getElementsByTagName('body')[0];
iframeDiv = document.createElement('div');
iframeDiv.style.position = "absolute";
iframeDiv.style.top = "0";
iframeDiv.style.left = "0";
iframeDiv.style.width = "100%";
iframeDiv.style.height = "100%";
iframeDiv.style.background = "#000";
iframeDiv.style.MozOpacity= "0.6";
iframe = document.createElement('iframe');
iframe.style.position = "absolute";
iframe.style.top = "50%";
iframe.style.left = "50%";
iframe.style.width = "300px";
iframe.style.height = "150px";
iframe.style.background = "#fff";
iframe.style.margin = "-75px 0 0 -150px";
iframe.style.MozOpacity= "1.0";
iframe.id = 'makeMarkIframe';
iframe.name = 'makeMarkIframe';
iframe.src = 'http://thirdleft.org/submit.php?url='+
encodeURIComponent(document.URL) + '&title=' +
encodeURIComponent(document.title);
/*iframe.onload = function() { console.log(frames['makeMarkIframe']);}
*/
iframeDiv.appendChild(iframe);
body.appendChild(iframeDiv);

iframe.onload triggers correctly - whenever the iframe loads a page -
but there doesn't seem to be anything I can test on the submissions
success without security issues (url parameters of the iframe are what
I've been trying for).

Unless the containing page is in the same domain, you can't get them.
Couldn't you just display a message in the IFrame concerning the
success of the submission? As for closing the box, you need to append
a link or button to do that when you create the IFrame.

Alternatively, you could get rid of the IFrame and use AJAX. It
sounds like you tried something of the sort, but was an IFrame still
involved?

Second question - No Iframe - but $.get from jquery errored out in
even getting submit.php (security).

I suppose a "close" prompt is enough - though automatic is nicer.

-Sud.
 
D

David Mark

I'm trying to make a bookmarklet/favlet thing that saves my bookmarks
remotely.
How it is supposed to work:
1. user clicks link on their toolbar.
2. javascript from my site loads, creating a lightbox-like prompt for
URL and title.
3. User hit form button to submit.
4. Ligthbox gives confimation message, then dissapears a few seconds
later
Part 4 is the problem. The confirmation comes up, but I keep on
recieving security errors (in firefox) from my remote script when I
try and see if the submission was a success.
the remote script is somthing like this:
=====
var body = document.getElementsByTagName('body')[0];
iframeDiv = document.createElement('div');
iframeDiv.style.position = "absolute";
iframeDiv.style.top = "0";
iframeDiv.style.left = "0";
iframeDiv.style.width = "100%";
iframeDiv.style.height = "100%";
iframeDiv.style.background = "#000";
iframeDiv.style.MozOpacity= "0.6";
iframe = document.createElement('iframe');
iframe.style.position = "absolute";
iframe.style.top = "50%";
iframe.style.left = "50%";
iframe.style.width = "300px";
iframe.style.height = "150px";
iframe.style.background = "#fff";
iframe.style.margin = "-75px 0 0 -150px";
iframe.style.MozOpacity= "1.0";
iframe.id = 'makeMarkIframe';
iframe.name = 'makeMarkIframe';
iframe.src = 'http://thirdleft.org/submit.php?url='+
encodeURIComponent(document.URL) + '&title=' +
encodeURIComponent(document.title);
/*iframe.onload = function() { console.log(frames['makeMarkIframe']);}
*/
iframeDiv.appendChild(iframe);
body.appendChild(iframeDiv);
=====
iframe.onload triggers correctly - whenever the iframe loads a page -
but there doesn't seem to be anything I can test on the submissions
success without security issues (url parameters of the iframe are what
I've been trying for).
Unless the containing page is in the same domain, you can't get them.
Couldn't you just display a message in the IFrame concerning the
success of the submission? As for closing the box, you need to append
a link or button to do that when you create the IFrame.
Alternatively, you could get rid of the IFrame and use AJAX. It
sounds like you tried something of the sort, but was an IFrame still
involved?

Second question - No Iframe - but $.get from jquery errored out in
even getting submit.php (security).

Try a jquery group. Or use a simple AJAX wrapper. Do you really need
jquery for this?
 

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top