473,387 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

JavaScript in SVG "cross compatability" with window.open

Hi,

I've been banging my head on the wall over this for about two days now
so any thoughts are much appreciated.

I have a static .svg file with embedded onclick="open()"'s all over.

The svg is <embed>ded in a minimal .html file.

The onclick's work fine in IE w/Adobe SVG viewer 3: click and a new
window opens with the specified URL.

But using the Adobe SVG viewer in Mozilla, neither the mouseovers or
the onclicks work, although the image itself renders.

However, the PRIMARY problem that I need to fix is that the onclick's
don't work in Safari with the Adobe viewer. The mouseovers DO work,
but the onclick's do not.

I've tried specifying window.open() instead of just open(). I've also
tried changing the onclicks to call a function openNewWindow which in
turn calls window.open. Still no luck in safari.

I've also tried defining the openNewWindow function in the html
wrapper, and specifying a3:scriptImplementation="browser". In this
case, the SVG still functions as desired in IE, but neither the
mouseovers nor the onclicks work in Safari.

To summarize, I need to get a new window with a specified URL to open
on click for Safari with the Adobe SVG viewer 3.

Thanks for any advice,

Joseph
Jul 23 '05 #1
4 7689
J Fisk wrote:
To summarize, I need to get a new window with a specified URL to open
on click for Safari with the Adobe SVG viewer 3.


Try top.window.open(), but AFAIK SVG vs. browser communication is only
available using (Win-)IE+ASV.

cu, Thomas
--
SVG - Learning By Coding
<http://svglbc.datenverdrahten.de/>
Jul 23 '05 #2


J Fisk wrote:
I've been banging my head on the wall over this for about two days now
so any thoughts are much appreciated.

I have a static .svg file with embedded onclick="open()"'s all over.

The svg is <embed>ded in a minimal .html file.

The onclick's work fine in IE w/Adobe SVG viewer 3: click and a new
window opens with the specified URL.

But using the Adobe SVG viewer in Mozilla, neither the mouseovers or
the onclicks work, although the image itself renders.

However, the PRIMARY problem that I need to fix is that the onclick's
don't work in Safari with the Adobe viewer. The mouseovers DO work,
but the onclick's do not.


With the following SVG example and Adobe SVG viewer 6 preview I get a
popup window opened when the circle is clicked with IE 6, Netscape 4,
and Netscape 7.1 however not with Opera 7.1:

<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.0"
viewBox="0 0 100 100">

<script type="text/ecmascript"><![CDATA[
function openPopup (url, windowName, features) {
if (typeof browserEval != 'undefined') {
browserEval('window.open("' + url + '", "' + windowName + '", "' +
features + '");');
}
}
]]></script>

<circle cx="20" cy="20" r="10" fill="green"
title="show HTML page with relative URL"
onclick="openPopup('whatever.html', 'svgWindowTest',
'width=300,height=300,scrollbars,resizable');" />

</svg>

Please report back whether that approach (using browserEval) works with
Safari and other browsers you test with on the Mac.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3
Hi,

I used your example and it works correctly on the following
browser/platform combos:

IE/windows
IE/mac
mozilla/linux
mozilla/mac
safari/mac

So, THANK you for this help.

But, I really don't understand WHY it works. Previously, mozilla
would issue "window.open is not a function" error, but we're still
using window.open .. so what gives? I'd even tested it using
browserEval, with no luck.

Thanks very much for the help!

Joseph

Martin Honnen <ma*******@yahoo.de> wrote in message news:<41********@olaf.komtel.net>...
With the following SVG example and Adobe SVG viewer 6 preview I get a
popup window opened when the circle is clicked with IE 6, Netscape 4,
and Netscape 7.1 however not with Opera 7.1:

<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.0"
viewBox="0 0 100 100">

<script type="text/ecmascript"><![CDATA[
function openPopup (url, windowName, features) {
if (typeof browserEval != 'undefined') {
browserEval('window.open("' + url + '", "' + windowName + '", "' +
features + '");');
}
}
]]></script>

<circle cx="20" cy="20" r="10" fill="green"
title="show HTML page with relative URL"
onclick="openPopup('whatever.html', 'svgWindowTest',
'width=300,height=300,scrollbars,resizable');" />

</svg>

Please report back whether that approach (using browserEval) works with
Safari and other browsers you test with on the Mac.

Jul 23 '05 #4


J Fisk wrote:

I used your example and it works correctly on the following
browser/platform combos:

IE/windows
IE/mac
mozilla/linux
mozilla/mac
safari/mac
But, I really don't understand WHY it works. Previously, mozilla
would issue "window.open is not a function" error, but we're still
using window.open .. so what gives?


With most browsers besides IE/Win the Adobe SVG viewer 3 uses its own
scripting engine which is not able to communicate with the browser's
scripting engine besides of the browserEval function.

If you look at the viewers documentation at
http://www.adobe.com/svg/indepth/pdf...entSupport.pdf
you will see that there is no window.open method defined for the window
object of the viewer and therefore you need to use the window.open
method of the browser window object and not that of the SVG viewer
window object. With IE/Win it is possible for plugins to directly
interact with the browser's scripting engine to access the browser's
window object but in other browsers that is not possible so there all
remains is to call browserEval and construct what you want to execute.

There is also some explanation of browserEval in the SVG wiki on the page
http://www.protocol7.com/svg-wiki/in...VGViewerWindow
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
2
by: matt | last post by:
Hi all- I'm trying to port an ajax spell-checker (http://www.broken-notebook.com/spell_checker/index.php) to use with the moin moin wiki and have been somewhat successful. (By successful I...
0
by: Walter Quirtmair | last post by:
Hello, I have a C# WinForms Application that contains various "old" ActiveX-Controls. Due to some unknown reasons recently the "red cross" - problems appears quite often. Without any know...
6
by: bwucke | last post by:
Short: One window writes to <input>, the other reads the same <input>. Is it a race condition or are the reads/writes atomic? Long: My app has an option to print results in a nicely formatted,...
1
by: Mesan | last post by:
I'm getting a "Cross-thread operation not valid" Exception and I can't figure out why. I've got a BackgroundWorker that creates a UserControl with a whole lot of other user controls inside of...
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
4
by: Mau Kae Horng | last post by:
Hello, I have a C# Windows Forms application for machine. Due to some unknown reasons, the application face problems with unexpected exceptions happening, resulting in two red lines forming a...
11
by: taoberly | last post by:
A few months ago I posted a question about using a file on my hard drive to perform cross-frame scripting and pull data from a server on my company's intranet. I eventually got this working using...
11
by: Ahmedhussain | last post by:
hey everyone... I have a code which gives me this error. Error : Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on. I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.