SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink Send page by email doesn't send js

    Hi,

    I just realized that if a user views one of my pages and clicks "Send page by email" (this is in IE) the js content is not included in the resulting email message.

    Is there a way around this?

    Thanks, Ed

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Hi,

    If anyone has any thoughts on this I would appreciate your input.

    I have some pages where the text portion comes from a js file like this:

    Code:
    <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="amybio.js"></SCRIPT>
    All of the text from the js file is omitted from the "send page by email" action.

    Why is this? Is there any way to change this?

    I know I could include alternate content in a
    Code:
    [script][/noscript]
    block but that would defeat the purpose of the js in the first place.

    I use the js input to avoid having to repeat redundant content on each page.

    Thanks, Ed

  3. #3
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Maybe use full address of js? It might work, I don't know. I noticed that external css isn't included in page send either.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the suggestion. I tried but it didn't work.

    I hate to have to eliminate js from my pages.

    Thanks, Ed

  5. #5
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What code are you using to send page by email, or are you sending a link? It might help to look at the code before suggesting anything.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by asp_funda
    What code are you using to send page by email, or are you sending a link? It might help to look at the code before suggesting anything.
    I'm not doing this via code, I'm using IE's menu function: File/Send/Page by email.

    This simply opens a new mail message with the full image of the page in the body of the message. (The user must set the Outlook default for message formatting to HTML, otherwise, a link is sent rather than the page).

    The problem is the message does not include any content placed on the page via js.

    I posted the js snippet used to include content in the body of the page (see the second message in this thread).

    I don't think there is a problem with my code as it displays properly on the screen.

    Is anyone else able to use the Page By Email feature when the content is included via js?

    Thanks, Ed

  7. #7
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you are using this technique, then whatever js generates will not be sent because js generates content dynamically & if you see the code of the page, then you will see the js code, not the content.

    For example, the following js code
    Code:
    document.write("Hello World!");
    will produce output
    Code:
    Hello World!
    This is what you'll see on your screen but if you have a look at the page source, you will see
    Code:
    document.write("Hello World!");
    And I think that Outlook blocks any scripts inside any e-mail message for security reasons, like Hotmail doesn't allow any scripts to run in HTML formatted emails that you view in your account.

    If you are using js to place content that's repetitive, then why not use server side includes? You can include a file in ASP as
    Code:
    <!--#include file="yourFile.html" -->
    in PHP as
    Code:
    <?php
    include('yourFile.html');
    ?>
    These will include the file at server & send only the output, so you will see the contents of yourFile.html instead of the include statements. Then you can send the page through email using outlook or any other email client.

    You should be able to use anyone of them since if you have paid for your web-space, then you must have been allowed a server-side language. Check with your host.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  8. #8
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by asp_funda
    What code are you using to send page by email, or are you sending a link? It might help to look at the code before suggesting anything.
    Here is a very simple code example to illustrate the point.

    The html doc:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
      <title></title>
    </head>
    <body>
       <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="test.js"></SCRIPT>
    </body>
    </html>
    And here is the test.js file:
    Code:
    document.write('This is a test');
    If you try this you can see that the body text comes from the .js file and displays properly on the screen.

    But if you try (in IE) File/Send/Page by email, the email that appears is empty.

    Is there another way to do this?

    Thanks, Ed

  9. #9
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Read my post above.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  10. #10
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by asp_funda
    If you are using js to place content that's repetitive, then why not use server side includes? You can include a file in ASP as...
    Thanks, I'll give that a try.

    Ed

  11. #11
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do so, that'll solve your problem.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  12. #12
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by asp_funda
    Do so, that'll solve your problem.
    While on the subject, is there any way using php to include a background image so that it will be emailed properly.

    I didn't bring up the fact that it's not only js content that's not emailed but the same thing happens with background images (I posted about that on the html forum. See: http://www.sitepointforums.com/showthread.php?t=146324).

    I can readily see how to include the content that was coming from js using php but it's not clear to me how you would handle background images.

    You can use php to place the code for the image in the resulting web page. But I think that would not solve the problem.

    Thanks, Ed

  13. #13
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you are using relative path for images, be it background or anything else, like
    Code:
    <body background="mypic.gif">
    <img src="hey.jpg">
    Your picture won't be emailed. Have a heart, how the hell the email client know where that picture is? You should use absolute paths for this like
    Code:
    <body background="http://www.sample.com/mypic.gif">
    <img src="http://www.sample.com/images/hey.jpg">
    Then whoever will be viewing email, they'll see the picture too since it will be pulled off from the server on which it resides.

    Also, if you want any links to work then you use absolute paths in them too like http://www.sample.com/mypage.html instead of mypage.html.

    But this is too much of pain in the neck, maintaining absolute paths. I think that I read about a <meta> tag that sets your base url or I think its <base> tag.

    Try this
    Code:
    <base href="http://www.sample.com/">
    Just place the tag in the head section & replace it with your domain ending with a slash(/). Now try using the path relative to the domain above, like for refering to images try "images/mypic.jpg", & for the links.
    It should work though & it'll save your problem of putting absolute paths.

    If it doesn't work, try looking the HTML section at http://www.w3schools.com/.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  14. #14
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by asp_funda
    You should use absolute paths for this like
    Code:
    <body background="http://www.sample.com/mypic.gif">
    <img src="http://www.sample.com/images/hey.jpg">
    Try this
    Code:
    <base href="http://www.sample.com/">
    Hi,

    I tried it both ways: with the absolute path spelled out and using the <base> tag. It didn't work.

    Images that are placed using <img src...> do work even without absolute addressing.

    So I don't think it's a matter of absolute addressing. It has to be something about background images in particular.

    I'll take a look at http://www.w3schools.com/.

    Thanks for your help!

    Ed

  15. #15
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well, its a pity it didn't work. I wasn't sure myself about the <base> tag though but absolute path is also not working, that's wierd.
    Maybe something to do with Outlook itself. Tell me what version are you using. I don't use Outlook myself or I would've told you in an instant. But I'll check in office at someone else's desktop & let you know(if I remain alive to tell you).
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  16. #16
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by asp_funda
    Well, its a pity it didn't work. I wasn't sure myself about the <base> tag though but absolute path is also not working, that's weird.
    Maybe something to do with Outlook itself. Tell me what version are you using. I don't use Outlook myself or I would've told you in an instant. But I'll check in office at someone else's desktop & let you know(if I remain alive to tell you).
    Hi,

    It's OL 2k3.

    But I just tried the same thing using Mozilla and got the same result.

    Background images don't appear to be sent with the email while other images are handled correctly.

    Please DO stay alive ;>)

    Thanks, Ed

  17. #17
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ed Hunter
    But I just tried the same thing using Mozilla and got the same result.

    Background images don't appear to be sent with the email while other images are handled correctly.
    Hmm!! Well, there ought to be a way. I'll check it if I get time. By the way, I think it would be better to send the link to the page than the page itself. That way the recipient's mailbox don't get full & he can view the page properly.
    My buddies used to send me pages like this & my mailbox suffered, so I told them to send me only links, like I do, & there hasn't been a problem since then.



    Quote Originally Posted by Ed Hunter
    Please DO stay alive ;>)
    Oh! I am & yes I will. I'll not let any pencil-pusher kill me just b'coz I sneaked up his PC while he was away. Its just too easy to sneak up to their PCs, they don't lock it while they are away, that's why they are pencil-pushers & not programmers like us.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  18. #18
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by asp_funda
    By the way, I think it would be better to send the link to the page than the page itself. That way the recipient's mailbox don't get full & he can view the page properly.
    I couldn't agree more! But the client is adamant about it. He thinks that people that view his site will want to send pages. I don't see the benefit but what can you do?

    Anyway, this is something that I think should work but doesn't. Should I call it a bug? I've searched Google for any discussion on this and came up empty.

    Thanks again, Ed

  19. #19
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah, you can't do much if the client is insisting on it, unless you have some great convincing powers.

    If your client is so much insistent on this, tell him that not everyone has Outlook etc & not everyone use it.

    If he's still biting your head off, then you can write a script to send the page by email. Then that'll work even if the visitor to the website doesn't have Outlook etc.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •